@aepstore-dev/contracts 1.27.0 → 1.29.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,203 +1,203 @@
1
- syntax = "proto3";
2
-
3
- package payments.v1;
4
-
5
- // Commerce + double-entry wallet/ledger (D9 / D9.2). See payments-service/docs/FINANCE.md.
6
- // Money = Decimal-as-string (D7). Statuses/enums as strings (avoid proto enum
7
- // value-name clashes within one package).
8
- service PaymentsService {
9
- // ----- buyer -----
10
- rpc Topup(TopupRequest) returns (CheckoutResponse);
11
- rpc CreateCheckout(CreateCheckoutRequest) returns (CheckoutResponse);
12
- rpc GetMyPurchases(GetMyPurchasesRequest) returns (PurchasesListResponse);
13
- rpc GetPurchase(GetPurchaseRequest) returns (Purchase);
14
- rpc RefundPurchase(RefundPurchaseRequest) returns (Purchase);
15
-
16
- // ----- wallet -----
17
- rpc GetWallet(GetWalletRequest) returns (WalletResponse);
18
- rpc ListTransactions(ListTransactionsRequest) returns (TransactionsListResponse);
19
-
20
- // ----- withdrawals -----
21
- rpc RequestWithdrawal(RequestWithdrawalRequest) returns (Withdrawal);
22
- rpc ListWithdrawals(ListWithdrawalsRequest) returns (WithdrawalsListResponse);
23
- rpc ProcessWithdrawal(ProcessWithdrawalRequest) returns (Withdrawal);
24
-
25
- // ----- provider webhook (gateway forwards a verified event) -----
26
- rpc HandlePaymentEvent(PaymentEventRequest) returns (Ok);
27
-
28
- // ----- admin -----
29
- rpc GetAdminOverview(AdminOverviewRequest) returns (AdminOverviewResponse);
30
- rpc AdminListTransactions(AdminListTransactionsRequest) returns (AdminTransactionsListResponse);
31
- rpc GetUserFinance(GetUserFinanceRequest) returns (UserFinanceResponse);
32
- rpc CreateAdjustment(CreateAdjustmentRequest) returns (Ok);
33
- rpc GetSalesAnalytics(SalesAnalyticsRequest) returns (SalesAnalyticsResponse);
34
- }
35
-
36
- message Ok { bool ok = 1; }
37
-
38
- // ---------------------------------------------------------------------------
39
- // Purchase / checkout / topup
40
- // ---------------------------------------------------------------------------
41
- message Purchase {
42
- string id = 1;
43
- string product_id = 2;
44
- string product_name = 3;
45
- string user_id = 4;
46
- string price = 5;
47
- string status = 6; // PENDING | COMPLETED | FAILED | REFUNDED
48
- string payment_id = 7;
49
- string payment_method = 8; // BALANCE | YOOKASSA
50
- string commission_percent = 9;
51
- string seller_amount = 10;
52
- string created_at = 11;
53
- string completed_at = 12;
54
- }
55
-
56
- message TopupRequest {
57
- string user_id = 1;
58
- string amount = 2; // >= 10.00
59
- string return_url = 3;
60
- }
61
-
62
- message CreateCheckoutRequest {
63
- string user_id = 1;
64
- string product_id = 2;
65
- string payment_method = 3; // BALANCE | YOOKASSA (default YOOKASSA)
66
- string return_url = 4;
67
- }
68
-
69
- message CheckoutResponse {
70
- string purchase_id = 1;
71
- string payment_id = 2;
72
- string confirmation_url = 3; // empty when paid from balance (instant)
73
- string status = 4; // PENDING (redirect) | COMPLETED (balance)
74
- }
75
-
76
- message GetMyPurchasesRequest { string user_id = 1; int32 page = 2; int32 limit = 3; }
77
- message PurchasesListResponse { repeated Purchase items = 1; int32 total = 2; int32 page = 3; int32 limit = 4; }
78
- message GetPurchaseRequest { string id = 1; string user_id = 2; }
79
- message RefundPurchaseRequest { string purchase_id = 1; string actor_user_id = 2; bool is_admin = 3; string reason = 4; }
80
-
81
- // ---------------------------------------------------------------------------
82
- // Wallet & statement
83
- // ---------------------------------------------------------------------------
84
- message GetWalletRequest { string user_id = 1; }
85
- message WalletResponse {
86
- string spending = 1;
87
- string pending = 2;
88
- string payout = 3;
89
- string spendable = 4; // spending + payout
90
- string withdrawable = 5; // payout
91
- string currency = 6;
92
- int32 lifetime_sales = 7;
93
- string current_commission_percent = 8;
94
- }
95
-
96
- message ListTransactionsRequest {
97
- string user_id = 1;
98
- string type = 2; // optional filter (TOPUP|PURCHASE|SALE_CLEAR|WITHDRAWAL|REFUND|ADJUSTMENT)
99
- int32 page = 3;
100
- int32 limit = 4;
101
- }
102
- message StatementEntry {
103
- string id = 1; // ledger entry id
104
- string tx_id = 2;
105
- string type = 3; // tx type
106
- string account_kind = 4; // which of the user's accounts
107
- string direction = 5; // DEBIT | CREDIT
108
- string amount = 6;
109
- string description = 7;
110
- string created_at = 8;
111
- }
112
- message TransactionsListResponse { repeated StatementEntry items = 1; int32 total = 2; int32 page = 3; int32 limit = 4; }
113
-
114
- // ---------------------------------------------------------------------------
115
- // Withdrawals
116
- // ---------------------------------------------------------------------------
117
- message Withdrawal {
118
- string id = 1;
119
- string seller_id = 2;
120
- string amount = 3;
121
- string status = 4; // PENDING | PROCESSING | COMPLETED | REJECTED
122
- string method = 5;
123
- string details = 6;
124
- string comment = 7;
125
- string processed_by = 8;
126
- string processed_at = 9;
127
- string created_at = 10;
128
- }
129
- message RequestWithdrawalRequest { string seller_id = 1; string amount = 2; string method = 3; string details = 4; }
130
- message ListWithdrawalsRequest { string seller_id = 1; string status = 2; int32 page = 3; int32 limit = 4; }
131
- message WithdrawalsListResponse { repeated Withdrawal items = 1; int32 total = 2; int32 page = 3; int32 limit = 4; }
132
- message ProcessWithdrawalRequest { string withdrawal_id = 1; string admin_id = 2; string action = 3; string comment = 4; }
133
-
134
- // ---------------------------------------------------------------------------
135
- // Webhook
136
- // ---------------------------------------------------------------------------
137
- message PaymentEventRequest { string event = 1; string payment_id = 2; }
138
-
139
- // ---------------------------------------------------------------------------
140
- // Admin
141
- // ---------------------------------------------------------------------------
142
- message AdminOverviewRequest { string from = 1; string to = 2; }
143
- message AdminOverviewResponse {
144
- string revenue = 1; // platform commission earned (period)
145
- string gmv = 2; // gross merchandise value (period)
146
- string liabilities = 3; // Σ all users' (pending+payout+spending) — what we owe
147
- string psp_clearing = 4; // money in transit at PSP
148
- string payouts_payable = 5; // reserved for approved withdrawals
149
- string refunds_total = 6;
150
- string topups_total = 7;
151
- string withdrawals_total = 8;
152
- int32 sales_count = 9;
153
- string currency = 10;
154
- }
155
-
156
- message AdminListTransactionsRequest {
157
- string type = 1;
158
- string user_id = 2;
159
- string account_kind = 3;
160
- string from = 4;
161
- string to = 5;
162
- int32 page = 6;
163
- int32 limit = 7;
164
- }
165
- message AdminEntry { string account_id = 1; string account_kind = 2; string owner_id = 3; string direction = 4; string amount = 5; }
166
- message AdminLedgerTx {
167
- string id = 1;
168
- string type = 2;
169
- string status = 3;
170
- string ref_type = 4;
171
- string ref_id = 5;
172
- string description = 6;
173
- string created_by = 7;
174
- string created_at = 8;
175
- repeated AdminEntry entries = 9;
176
- }
177
- message AdminTransactionsListResponse { repeated AdminLedgerTx items = 1; int32 total = 2; int32 page = 3; int32 limit = 4; }
178
-
179
- message GetUserFinanceRequest { string user_id = 1; }
180
- message AccountBalance { string kind = 1; string balance = 2; string currency = 3; }
181
- message UserFinanceResponse {
182
- WalletResponse wallet = 1;
183
- repeated AccountBalance accounts = 2;
184
- repeated StatementEntry recent = 3;
185
- }
186
-
187
- message CreateAdjustmentRequest {
188
- string admin_id = 1;
189
- string user_id = 2;
190
- string account_kind = 3; // USER_SPENDING | USER_PAYOUT | USER_PENDING
191
- string direction = 4; // CREDIT (give) | DEBIT (take)
192
- string amount = 5;
193
- string reason = 6;
194
- }
195
-
196
- message SalesAnalyticsRequest { string from = 1; string to = 2; string granularity = 3; } // day|week|month
197
- message SalesPoint { string date = 1; int32 sales_count = 2; string gmv = 3; string revenue = 4; }
198
- message SellerStat { string seller_id = 1; string username = 2; int32 sales = 3; string gmv = 4; }
199
- message SalesAnalyticsResponse {
200
- repeated SalesPoint points = 1;
201
- repeated SellerStat top_sellers = 2;
202
- string refund_rate = 3; // % refunded purchases
203
- }
1
+ syntax = "proto3";
2
+
3
+ package payments.v1;
4
+
5
+ // Commerce + double-entry wallet/ledger (D9 / D9.2). See payments-service/docs/FINANCE.md.
6
+ // Money = Decimal-as-string (D7). Statuses/enums as strings (avoid proto enum
7
+ // value-name clashes within one package).
8
+ service PaymentsService {
9
+ // ----- buyer -----
10
+ rpc Topup(TopupRequest) returns (CheckoutResponse);
11
+ rpc CreateCheckout(CreateCheckoutRequest) returns (CheckoutResponse);
12
+ rpc GetMyPurchases(GetMyPurchasesRequest) returns (PurchasesListResponse);
13
+ rpc GetPurchase(GetPurchaseRequest) returns (Purchase);
14
+ rpc RefundPurchase(RefundPurchaseRequest) returns (Purchase);
15
+
16
+ // ----- wallet -----
17
+ rpc GetWallet(GetWalletRequest) returns (WalletResponse);
18
+ rpc ListTransactions(ListTransactionsRequest) returns (TransactionsListResponse);
19
+
20
+ // ----- withdrawals -----
21
+ rpc RequestWithdrawal(RequestWithdrawalRequest) returns (Withdrawal);
22
+ rpc ListWithdrawals(ListWithdrawalsRequest) returns (WithdrawalsListResponse);
23
+ rpc ProcessWithdrawal(ProcessWithdrawalRequest) returns (Withdrawal);
24
+
25
+ // ----- provider webhook (gateway forwards a verified event) -----
26
+ rpc HandlePaymentEvent(PaymentEventRequest) returns (Ok);
27
+
28
+ // ----- admin -----
29
+ rpc GetAdminOverview(AdminOverviewRequest) returns (AdminOverviewResponse);
30
+ rpc AdminListTransactions(AdminListTransactionsRequest) returns (AdminTransactionsListResponse);
31
+ rpc GetUserFinance(GetUserFinanceRequest) returns (UserFinanceResponse);
32
+ rpc CreateAdjustment(CreateAdjustmentRequest) returns (Ok);
33
+ rpc GetSalesAnalytics(SalesAnalyticsRequest) returns (SalesAnalyticsResponse);
34
+ }
35
+
36
+ message Ok { bool ok = 1; }
37
+
38
+ // ---------------------------------------------------------------------------
39
+ // Purchase / checkout / topup
40
+ // ---------------------------------------------------------------------------
41
+ message Purchase {
42
+ string id = 1;
43
+ string product_id = 2;
44
+ string product_name = 3;
45
+ string user_id = 4;
46
+ string price = 5;
47
+ string status = 6; // PENDING | COMPLETED | FAILED | REFUNDED
48
+ string payment_id = 7;
49
+ string payment_method = 8; // BALANCE | YOOKASSA
50
+ string commission_percent = 9;
51
+ string seller_amount = 10;
52
+ string created_at = 11;
53
+ string completed_at = 12;
54
+ }
55
+
56
+ message TopupRequest {
57
+ string user_id = 1;
58
+ string amount = 2; // >= 10.00
59
+ string return_url = 3;
60
+ }
61
+
62
+ message CreateCheckoutRequest {
63
+ string user_id = 1;
64
+ string product_id = 2;
65
+ string payment_method = 3; // BALANCE | YOOKASSA (default YOOKASSA)
66
+ string return_url = 4;
67
+ }
68
+
69
+ message CheckoutResponse {
70
+ string purchase_id = 1;
71
+ string payment_id = 2;
72
+ string confirmation_url = 3; // empty when paid from balance (instant)
73
+ string status = 4; // PENDING (redirect) | COMPLETED (balance)
74
+ }
75
+
76
+ message GetMyPurchasesRequest { string user_id = 1; int32 page = 2; int32 limit = 3; }
77
+ message PurchasesListResponse { repeated Purchase items = 1; int32 total = 2; int32 page = 3; int32 limit = 4; }
78
+ message GetPurchaseRequest { string id = 1; string user_id = 2; }
79
+ message RefundPurchaseRequest { string purchase_id = 1; string actor_user_id = 2; bool is_admin = 3; string reason = 4; }
80
+
81
+ // ---------------------------------------------------------------------------
82
+ // Wallet & statement
83
+ // ---------------------------------------------------------------------------
84
+ message GetWalletRequest { string user_id = 1; }
85
+ message WalletResponse {
86
+ string spending = 1;
87
+ string pending = 2;
88
+ string payout = 3;
89
+ string spendable = 4; // spending + payout
90
+ string withdrawable = 5; // payout
91
+ string currency = 6;
92
+ int32 lifetime_sales = 7;
93
+ string current_commission_percent = 8;
94
+ }
95
+
96
+ message ListTransactionsRequest {
97
+ string user_id = 1;
98
+ string type = 2; // optional filter (TOPUP|PURCHASE|SALE_CLEAR|WITHDRAWAL|REFUND|ADJUSTMENT)
99
+ int32 page = 3;
100
+ int32 limit = 4;
101
+ }
102
+ message StatementEntry {
103
+ string id = 1; // ledger entry id
104
+ string tx_id = 2;
105
+ string type = 3; // tx type
106
+ string account_kind = 4; // which of the user's accounts
107
+ string direction = 5; // DEBIT | CREDIT
108
+ string amount = 6;
109
+ string description = 7;
110
+ string created_at = 8;
111
+ }
112
+ message TransactionsListResponse { repeated StatementEntry items = 1; int32 total = 2; int32 page = 3; int32 limit = 4; }
113
+
114
+ // ---------------------------------------------------------------------------
115
+ // Withdrawals
116
+ // ---------------------------------------------------------------------------
117
+ message Withdrawal {
118
+ string id = 1;
119
+ string seller_id = 2;
120
+ string amount = 3;
121
+ string status = 4; // PENDING | PROCESSING | COMPLETED | REJECTED
122
+ string method = 5;
123
+ string details = 6;
124
+ string comment = 7;
125
+ string processed_by = 8;
126
+ string processed_at = 9;
127
+ string created_at = 10;
128
+ }
129
+ message RequestWithdrawalRequest { string seller_id = 1; string amount = 2; string method = 3; string details = 4; }
130
+ message ListWithdrawalsRequest { string seller_id = 1; string status = 2; int32 page = 3; int32 limit = 4; }
131
+ message WithdrawalsListResponse { repeated Withdrawal items = 1; int32 total = 2; int32 page = 3; int32 limit = 4; }
132
+ message ProcessWithdrawalRequest { string withdrawal_id = 1; string admin_id = 2; string action = 3; string comment = 4; }
133
+
134
+ // ---------------------------------------------------------------------------
135
+ // Webhook
136
+ // ---------------------------------------------------------------------------
137
+ message PaymentEventRequest { string event = 1; string payment_id = 2; }
138
+
139
+ // ---------------------------------------------------------------------------
140
+ // Admin
141
+ // ---------------------------------------------------------------------------
142
+ message AdminOverviewRequest { string from = 1; string to = 2; }
143
+ message AdminOverviewResponse {
144
+ string revenue = 1; // platform commission earned (period)
145
+ string gmv = 2; // gross merchandise value (period)
146
+ string liabilities = 3; // Σ all users' (pending+payout+spending) — what we owe
147
+ string psp_clearing = 4; // money in transit at PSP
148
+ string payouts_payable = 5; // reserved for approved withdrawals
149
+ string refunds_total = 6;
150
+ string topups_total = 7;
151
+ string withdrawals_total = 8;
152
+ int32 sales_count = 9;
153
+ string currency = 10;
154
+ }
155
+
156
+ message AdminListTransactionsRequest {
157
+ string type = 1;
158
+ string user_id = 2;
159
+ string account_kind = 3;
160
+ string from = 4;
161
+ string to = 5;
162
+ int32 page = 6;
163
+ int32 limit = 7;
164
+ }
165
+ message AdminEntry { string account_id = 1; string account_kind = 2; string owner_id = 3; string direction = 4; string amount = 5; }
166
+ message AdminLedgerTx {
167
+ string id = 1;
168
+ string type = 2;
169
+ string status = 3;
170
+ string ref_type = 4;
171
+ string ref_id = 5;
172
+ string description = 6;
173
+ string created_by = 7;
174
+ string created_at = 8;
175
+ repeated AdminEntry entries = 9;
176
+ }
177
+ message AdminTransactionsListResponse { repeated AdminLedgerTx items = 1; int32 total = 2; int32 page = 3; int32 limit = 4; }
178
+
179
+ message GetUserFinanceRequest { string user_id = 1; }
180
+ message AccountBalance { string kind = 1; string balance = 2; string currency = 3; }
181
+ message UserFinanceResponse {
182
+ WalletResponse wallet = 1;
183
+ repeated AccountBalance accounts = 2;
184
+ repeated StatementEntry recent = 3;
185
+ }
186
+
187
+ message CreateAdjustmentRequest {
188
+ string admin_id = 1;
189
+ string user_id = 2;
190
+ string account_kind = 3; // USER_SPENDING | USER_PAYOUT | USER_PENDING
191
+ string direction = 4; // CREDIT (give) | DEBIT (take)
192
+ string amount = 5;
193
+ string reason = 6;
194
+ }
195
+
196
+ message SalesAnalyticsRequest { string from = 1; string to = 2; string granularity = 3; } // day|week|month
197
+ message SalesPoint { string date = 1; int32 sales_count = 2; string gmv = 3; string revenue = 4; }
198
+ message SellerStat { string seller_id = 1; string username = 2; int32 sales = 3; string gmv = 4; }
199
+ message SalesAnalyticsResponse {
200
+ repeated SalesPoint points = 1;
201
+ repeated SellerStat top_sellers = 2;
202
+ string refund_rate = 3; // % refunded purchases
203
+ }
@@ -1,118 +1,118 @@
1
- syntax = "proto3";
2
-
3
- package support.v1;
4
-
5
- // Support ticket system (G1). Enums as strings matching the DB
6
- // (status OPEN|PENDING|IN_PROGRESS|RESOLVED|CLOSED; category/priority).
7
- service SupportService {
8
- rpc Ping(PingRequest) returns (PingResponse); // health
9
-
10
- // user
11
- rpc CreateTicket(CreateTicketRequest) returns (Ticket);
12
- rpc GetTicket(GetTicketRequest) returns (TicketWithMessages);
13
- rpc ListMyTickets(ListMyTicketsRequest) returns (TicketsListResponse);
14
- rpc ReplyTicket(ReplyTicketRequest) returns (TicketMessage);
15
- rpc CloseTicket(CloseTicketRequest) returns (Ticket);
16
-
17
- // staff/admin
18
- rpc ListTickets(ListTicketsRequest) returns (TicketsListResponse);
19
- rpc AssignTicket(AssignTicketRequest) returns (Ticket);
20
- rpc SetTicketStatus(SetTicketStatusRequest) returns (Ticket);
21
- }
22
-
23
- message PingRequest { string message = 1; }
24
- message PingResponse { bool ok = 1; string message = 2; }
25
-
26
- message Ticket {
27
- string id = 1;
28
- string author_id = 2;
29
- string subject = 3;
30
- string category = 4; // GENERAL|PAYMENT|WITHDRAWAL|PRODUCT|ACCOUNT|ABUSE|OTHER
31
- string status = 5; // OPEN|PENDING|IN_PROGRESS|RESOLVED|CLOSED
32
- string priority = 6; // LOW|NORMAL|HIGH|URGENT
33
- string purchase_id = 7;
34
- string withdrawal_id = 8;
35
- string assignee_id = 9;
36
- string last_message_at = 10;
37
- string created_at = 11;
38
- string updated_at = 12;
39
- int32 messages_count = 13;
40
- }
41
-
42
- message TicketMessage {
43
- string id = 1;
44
- string ticket_id = 2;
45
- string author_id = 3;
46
- string body = 4;
47
- bool is_staff = 5;
48
- bool is_internal = 6;
49
- string created_at = 7;
50
- }
51
-
52
- message TicketWithMessages {
53
- Ticket ticket = 1;
54
- repeated TicketMessage messages = 2;
55
- }
56
-
57
- message CreateTicketRequest {
58
- string author_id = 1;
59
- string subject = 2;
60
- string category = 3;
61
- string body = 4; // first message
62
- string purchase_id = 5; // optional
63
- string withdrawal_id = 6; // optional
64
- }
65
-
66
- message GetTicketRequest {
67
- string id = 1;
68
- string requester_id = 2;
69
- bool is_staff = 3; // staff see internal notes + any ticket
70
- }
71
-
72
- message ListMyTicketsRequest {
73
- string author_id = 1;
74
- string status = 2;
75
- int32 page = 3;
76
- int32 limit = 4;
77
- }
78
-
79
- message ReplyTicketRequest {
80
- string ticket_id = 1;
81
- string author_id = 2;
82
- string body = 3;
83
- bool is_staff = 4;
84
- bool is_internal = 5; // staff-only note
85
- }
86
-
87
- message CloseTicketRequest {
88
- string ticket_id = 1;
89
- string requester_id = 2;
90
- bool is_staff = 3;
91
- }
92
-
93
- message ListTicketsRequest {
94
- string status = 1;
95
- string category = 2;
96
- string assignee_id = 3;
97
- int32 page = 4;
98
- int32 limit = 5;
99
- }
100
-
101
- message AssignTicketRequest {
102
- string ticket_id = 1;
103
- string assignee_id = 2; // empty = unassign
104
- string admin_id = 3;
105
- }
106
-
107
- message SetTicketStatusRequest {
108
- string ticket_id = 1;
109
- string status = 2;
110
- string admin_id = 3;
111
- }
112
-
113
- message TicketsListResponse {
114
- repeated Ticket items = 1;
115
- int32 total = 2;
116
- int32 page = 3;
117
- int32 limit = 4;
118
- }
1
+ syntax = "proto3";
2
+
3
+ package support.v1;
4
+
5
+ // Support ticket system (G1). Enums as strings matching the DB
6
+ // (status OPEN|PENDING|IN_PROGRESS|RESOLVED|CLOSED; category/priority).
7
+ service SupportService {
8
+ rpc Ping(PingRequest) returns (PingResponse); // health
9
+
10
+ // user
11
+ rpc CreateTicket(CreateTicketRequest) returns (Ticket);
12
+ rpc GetTicket(GetTicketRequest) returns (TicketWithMessages);
13
+ rpc ListMyTickets(ListMyTicketsRequest) returns (TicketsListResponse);
14
+ rpc ReplyTicket(ReplyTicketRequest) returns (TicketMessage);
15
+ rpc CloseTicket(CloseTicketRequest) returns (Ticket);
16
+
17
+ // staff/admin
18
+ rpc ListTickets(ListTicketsRequest) returns (TicketsListResponse);
19
+ rpc AssignTicket(AssignTicketRequest) returns (Ticket);
20
+ rpc SetTicketStatus(SetTicketStatusRequest) returns (Ticket);
21
+ }
22
+
23
+ message PingRequest { string message = 1; }
24
+ message PingResponse { bool ok = 1; string message = 2; }
25
+
26
+ message Ticket {
27
+ string id = 1;
28
+ string author_id = 2;
29
+ string subject = 3;
30
+ string category = 4; // GENERAL|PAYMENT|WITHDRAWAL|PRODUCT|ACCOUNT|ABUSE|OTHER
31
+ string status = 5; // OPEN|PENDING|IN_PROGRESS|RESOLVED|CLOSED
32
+ string priority = 6; // LOW|NORMAL|HIGH|URGENT
33
+ string purchase_id = 7;
34
+ string withdrawal_id = 8;
35
+ string assignee_id = 9;
36
+ string last_message_at = 10;
37
+ string created_at = 11;
38
+ string updated_at = 12;
39
+ int32 messages_count = 13;
40
+ }
41
+
42
+ message TicketMessage {
43
+ string id = 1;
44
+ string ticket_id = 2;
45
+ string author_id = 3;
46
+ string body = 4;
47
+ bool is_staff = 5;
48
+ bool is_internal = 6;
49
+ string created_at = 7;
50
+ }
51
+
52
+ message TicketWithMessages {
53
+ Ticket ticket = 1;
54
+ repeated TicketMessage messages = 2;
55
+ }
56
+
57
+ message CreateTicketRequest {
58
+ string author_id = 1;
59
+ string subject = 2;
60
+ string category = 3;
61
+ string body = 4; // first message
62
+ string purchase_id = 5; // optional
63
+ string withdrawal_id = 6; // optional
64
+ }
65
+
66
+ message GetTicketRequest {
67
+ string id = 1;
68
+ string requester_id = 2;
69
+ bool is_staff = 3; // staff see internal notes + any ticket
70
+ }
71
+
72
+ message ListMyTicketsRequest {
73
+ string author_id = 1;
74
+ string status = 2;
75
+ int32 page = 3;
76
+ int32 limit = 4;
77
+ }
78
+
79
+ message ReplyTicketRequest {
80
+ string ticket_id = 1;
81
+ string author_id = 2;
82
+ string body = 3;
83
+ bool is_staff = 4;
84
+ bool is_internal = 5; // staff-only note
85
+ }
86
+
87
+ message CloseTicketRequest {
88
+ string ticket_id = 1;
89
+ string requester_id = 2;
90
+ bool is_staff = 3;
91
+ }
92
+
93
+ message ListTicketsRequest {
94
+ string status = 1;
95
+ string category = 2;
96
+ string assignee_id = 3;
97
+ int32 page = 4;
98
+ int32 limit = 5;
99
+ }
100
+
101
+ message AssignTicketRequest {
102
+ string ticket_id = 1;
103
+ string assignee_id = 2; // empty = unassign
104
+ string admin_id = 3;
105
+ }
106
+
107
+ message SetTicketStatusRequest {
108
+ string ticket_id = 1;
109
+ string status = 2;
110
+ string admin_id = 3;
111
+ }
112
+
113
+ message TicketsListResponse {
114
+ repeated Ticket items = 1;
115
+ int32 total = 2;
116
+ int32 page = 3;
117
+ int32 limit = 4;
118
+ }