@aepstore-dev/contracts 1.32.0 → 1.34.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.
- package/gen/auth.ts +34 -0
- package/gen/payments.ts +285 -0
- package/gen/users.ts +570 -0
- package/package.json +1 -1
- package/proto/activity.proto +200 -200
- package/proto/auth.proto +144 -126
- package/proto/mail.proto +42 -42
- package/proto/payments.proto +356 -203
- package/proto/products.proto +404 -404
- package/proto/support.proto +118 -118
- package/proto/taxonomy.proto +105 -105
- package/proto/upload.proto +171 -171
- package/proto/users.proto +660 -286
package/proto/mail.proto
CHANGED
|
@@ -1,42 +1,42 @@
|
|
|
1
|
-
syntax = "proto3";
|
|
2
|
-
|
|
3
|
-
package mail.v1;
|
|
4
|
-
|
|
5
|
-
// Legacy mail-service used @EventPattern (fire-and-forget). In the new gRPC
|
|
6
|
-
// stack each becomes a unary RPC that returns an Ack. Callers ignore the
|
|
7
|
-
// response if they don't care about delivery.
|
|
8
|
-
service MailService {
|
|
9
|
-
rpc SendReg(SendRegRequest) returns (MailAck);
|
|
10
|
-
rpc Send2fa(Send2faRequest) returns (MailAck);
|
|
11
|
-
rpc SendPasswordReset(SendPasswordResetRequest) returns (MailAck);
|
|
12
|
-
rpc SendRegistrationConfirm(SendRegistrationConfirmRequest) returns (MailAck);
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
message MailAck {
|
|
16
|
-
bool queued = 1;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
message SendRegRequest {
|
|
20
|
-
string user_id = 1;
|
|
21
|
-
string email = 2;
|
|
22
|
-
string username = 3;
|
|
23
|
-
string full_name = 4;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
message Send2faRequest {
|
|
27
|
-
string email = 1;
|
|
28
|
-
string code = 2;
|
|
29
|
-
string username = 3;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
message SendPasswordResetRequest {
|
|
33
|
-
string email = 1;
|
|
34
|
-
string code = 2;
|
|
35
|
-
string username = 3;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
message SendRegistrationConfirmRequest {
|
|
39
|
-
string email = 1;
|
|
40
|
-
string code = 2;
|
|
41
|
-
string username = 3;
|
|
42
|
-
}
|
|
1
|
+
syntax = "proto3";
|
|
2
|
+
|
|
3
|
+
package mail.v1;
|
|
4
|
+
|
|
5
|
+
// Legacy mail-service used @EventPattern (fire-and-forget). In the new gRPC
|
|
6
|
+
// stack each becomes a unary RPC that returns an Ack. Callers ignore the
|
|
7
|
+
// response if they don't care about delivery.
|
|
8
|
+
service MailService {
|
|
9
|
+
rpc SendReg(SendRegRequest) returns (MailAck);
|
|
10
|
+
rpc Send2fa(Send2faRequest) returns (MailAck);
|
|
11
|
+
rpc SendPasswordReset(SendPasswordResetRequest) returns (MailAck);
|
|
12
|
+
rpc SendRegistrationConfirm(SendRegistrationConfirmRequest) returns (MailAck);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
message MailAck {
|
|
16
|
+
bool queued = 1;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
message SendRegRequest {
|
|
20
|
+
string user_id = 1;
|
|
21
|
+
string email = 2;
|
|
22
|
+
string username = 3;
|
|
23
|
+
string full_name = 4;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
message Send2faRequest {
|
|
27
|
+
string email = 1;
|
|
28
|
+
string code = 2;
|
|
29
|
+
string username = 3;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
message SendPasswordResetRequest {
|
|
33
|
+
string email = 1;
|
|
34
|
+
string code = 2;
|
|
35
|
+
string username = 3;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
message SendRegistrationConfirmRequest {
|
|
39
|
+
string email = 1;
|
|
40
|
+
string code = 2;
|
|
41
|
+
string username = 3;
|
|
42
|
+
}
|
package/proto/payments.proto
CHANGED
|
@@ -1,203 +1,356 @@
|
|
|
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
|
-
// -----
|
|
29
|
-
rpc
|
|
30
|
-
rpc
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
rpc
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
//
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
message
|
|
63
|
-
string
|
|
64
|
-
string product_id = 2;
|
|
65
|
-
string
|
|
66
|
-
string
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
string
|
|
71
|
-
string
|
|
72
|
-
string
|
|
73
|
-
string
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
message
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
string
|
|
87
|
-
string
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
string
|
|
92
|
-
|
|
93
|
-
string
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
string
|
|
108
|
-
string
|
|
109
|
-
string
|
|
110
|
-
string
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
message
|
|
118
|
-
string
|
|
119
|
-
string
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
string
|
|
125
|
-
string
|
|
126
|
-
string
|
|
127
|
-
string
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
//
|
|
136
|
-
//
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
string
|
|
145
|
-
string
|
|
146
|
-
string
|
|
147
|
-
string
|
|
148
|
-
string
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
string
|
|
168
|
-
string
|
|
169
|
-
string
|
|
170
|
-
string
|
|
171
|
-
string
|
|
172
|
-
string
|
|
173
|
-
|
|
174
|
-
string
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
message
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
}
|
|
186
|
-
|
|
187
|
-
message
|
|
188
|
-
string
|
|
189
|
-
string
|
|
190
|
-
string
|
|
191
|
-
string
|
|
192
|
-
string
|
|
193
|
-
string
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
message
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
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
|
+
// ----- premium -----
|
|
29
|
+
rpc GetPremiumPlans(GetPremiumPlansRequest) returns (PremiumPlansResponse);
|
|
30
|
+
rpc PurchasePremium(PurchasePremiumRequest) returns (PurchasePremiumResponse);
|
|
31
|
+
// 7-day refund window from completedAt. Reverses ledger, calls YooKassa for
|
|
32
|
+
// card purchases, rolls back the subscription's expiresAt by the period.
|
|
33
|
+
rpc RefundPremium(RefundPremiumRequest) returns (RefundPremiumResponse);
|
|
34
|
+
rpc GetMyPremiumPayments(GetMyPremiumPaymentsRequest) returns (PremiumPaymentsListResponse);
|
|
35
|
+
// Internal — InternalServiceGuard. tasks-service cron triggers due renewals;
|
|
36
|
+
// payments-service iterates ACTIVE subscriptions with autoRenew+savedCard.
|
|
37
|
+
rpc RunPremiumRenewals(RunPremiumRenewalsRequest) returns (RunPremiumRenewalsResponse);
|
|
38
|
+
|
|
39
|
+
// ----- saved cards -----
|
|
40
|
+
rpc ListSavedCards(ListSavedCardsRequest) returns (ListSavedCardsResponse);
|
|
41
|
+
rpc DeleteSavedCard(DeleteSavedCardRequest) returns (Ok);
|
|
42
|
+
rpc SetDefaultSavedCard(SetDefaultSavedCardRequest) returns (SavedCard);
|
|
43
|
+
rpc UpdateSavedCard(UpdateSavedCardRequest) returns (SavedCard);
|
|
44
|
+
|
|
45
|
+
// ----- payout details -----
|
|
46
|
+
rpc UpdatePayoutDetails(UpdatePayoutDetailsRequest) returns (UpdatePayoutDetailsResponse);
|
|
47
|
+
rpc GetPayoutDetails(GetPayoutDetailsRequest) returns (UpdatePayoutDetailsResponse);
|
|
48
|
+
|
|
49
|
+
// ----- admin -----
|
|
50
|
+
rpc GetAdminOverview(AdminOverviewRequest) returns (AdminOverviewResponse);
|
|
51
|
+
rpc AdminListTransactions(AdminListTransactionsRequest) returns (AdminTransactionsListResponse);
|
|
52
|
+
rpc GetUserFinance(GetUserFinanceRequest) returns (UserFinanceResponse);
|
|
53
|
+
rpc CreateAdjustment(CreateAdjustmentRequest) returns (Ok);
|
|
54
|
+
rpc GetSalesAnalytics(SalesAnalyticsRequest) returns (SalesAnalyticsResponse);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
message Ok { bool ok = 1; }
|
|
58
|
+
|
|
59
|
+
// ---------------------------------------------------------------------------
|
|
60
|
+
// Purchase / checkout / topup
|
|
61
|
+
// ---------------------------------------------------------------------------
|
|
62
|
+
message Purchase {
|
|
63
|
+
string id = 1;
|
|
64
|
+
string product_id = 2;
|
|
65
|
+
string product_name = 3;
|
|
66
|
+
string user_id = 4;
|
|
67
|
+
string price = 5;
|
|
68
|
+
string status = 6; // PENDING | COMPLETED | FAILED | REFUNDED
|
|
69
|
+
string payment_id = 7;
|
|
70
|
+
string payment_method = 8; // BALANCE | YOOKASSA
|
|
71
|
+
string commission_percent = 9;
|
|
72
|
+
string seller_amount = 10;
|
|
73
|
+
string created_at = 11;
|
|
74
|
+
string completed_at = 12;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
message TopupRequest {
|
|
78
|
+
string user_id = 1;
|
|
79
|
+
string amount = 2; // >= 10.00
|
|
80
|
+
string return_url = 3;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
message CreateCheckoutRequest {
|
|
84
|
+
string user_id = 1;
|
|
85
|
+
string product_id = 2;
|
|
86
|
+
string payment_method = 3; // BALANCE | YOOKASSA (default YOOKASSA)
|
|
87
|
+
string return_url = 4;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
message CheckoutResponse {
|
|
91
|
+
string purchase_id = 1;
|
|
92
|
+
string payment_id = 2;
|
|
93
|
+
string confirmation_url = 3; // empty when paid from balance (instant)
|
|
94
|
+
string status = 4; // PENDING (redirect) | COMPLETED (balance)
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
message GetMyPurchasesRequest { string user_id = 1; int32 page = 2; int32 limit = 3; }
|
|
98
|
+
message PurchasesListResponse { repeated Purchase items = 1; int32 total = 2; int32 page = 3; int32 limit = 4; }
|
|
99
|
+
message GetPurchaseRequest { string id = 1; string user_id = 2; }
|
|
100
|
+
message RefundPurchaseRequest { string purchase_id = 1; string actor_user_id = 2; bool is_admin = 3; string reason = 4; }
|
|
101
|
+
|
|
102
|
+
// ---------------------------------------------------------------------------
|
|
103
|
+
// Wallet & statement
|
|
104
|
+
// ---------------------------------------------------------------------------
|
|
105
|
+
message GetWalletRequest { string user_id = 1; }
|
|
106
|
+
message WalletResponse {
|
|
107
|
+
string spending = 1;
|
|
108
|
+
string pending = 2;
|
|
109
|
+
string payout = 3;
|
|
110
|
+
string spendable = 4; // spending + payout
|
|
111
|
+
string withdrawable = 5; // payout
|
|
112
|
+
string currency = 6;
|
|
113
|
+
int32 lifetime_sales = 7;
|
|
114
|
+
string current_commission_percent = 8;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
message ListTransactionsRequest {
|
|
118
|
+
string user_id = 1;
|
|
119
|
+
string type = 2; // optional filter (TOPUP|PURCHASE|SALE_CLEAR|WITHDRAWAL|REFUND|ADJUSTMENT)
|
|
120
|
+
int32 page = 3;
|
|
121
|
+
int32 limit = 4;
|
|
122
|
+
}
|
|
123
|
+
message StatementEntry {
|
|
124
|
+
string id = 1; // ledger entry id
|
|
125
|
+
string tx_id = 2;
|
|
126
|
+
string type = 3; // tx type
|
|
127
|
+
string account_kind = 4; // which of the user's accounts
|
|
128
|
+
string direction = 5; // DEBIT | CREDIT
|
|
129
|
+
string amount = 6;
|
|
130
|
+
string description = 7;
|
|
131
|
+
string created_at = 8;
|
|
132
|
+
}
|
|
133
|
+
message TransactionsListResponse { repeated StatementEntry items = 1; int32 total = 2; int32 page = 3; int32 limit = 4; }
|
|
134
|
+
|
|
135
|
+
// ---------------------------------------------------------------------------
|
|
136
|
+
// Withdrawals
|
|
137
|
+
// ---------------------------------------------------------------------------
|
|
138
|
+
message Withdrawal {
|
|
139
|
+
string id = 1;
|
|
140
|
+
string seller_id = 2;
|
|
141
|
+
string amount = 3;
|
|
142
|
+
string status = 4; // PENDING | PROCESSING | COMPLETED | REJECTED
|
|
143
|
+
string method = 5;
|
|
144
|
+
string details = 6;
|
|
145
|
+
string comment = 7;
|
|
146
|
+
string processed_by = 8;
|
|
147
|
+
string processed_at = 9;
|
|
148
|
+
string created_at = 10;
|
|
149
|
+
}
|
|
150
|
+
message RequestWithdrawalRequest { string seller_id = 1; string amount = 2; string method = 3; string details = 4; }
|
|
151
|
+
message ListWithdrawalsRequest { string seller_id = 1; string status = 2; int32 page = 3; int32 limit = 4; }
|
|
152
|
+
message WithdrawalsListResponse { repeated Withdrawal items = 1; int32 total = 2; int32 page = 3; int32 limit = 4; }
|
|
153
|
+
message ProcessWithdrawalRequest { string withdrawal_id = 1; string admin_id = 2; string action = 3; string comment = 4; }
|
|
154
|
+
|
|
155
|
+
// ---------------------------------------------------------------------------
|
|
156
|
+
// Webhook
|
|
157
|
+
// ---------------------------------------------------------------------------
|
|
158
|
+
message PaymentEventRequest { string event = 1; string payment_id = 2; }
|
|
159
|
+
|
|
160
|
+
// ---------------------------------------------------------------------------
|
|
161
|
+
// Admin
|
|
162
|
+
// ---------------------------------------------------------------------------
|
|
163
|
+
message AdminOverviewRequest { string from = 1; string to = 2; }
|
|
164
|
+
message AdminOverviewResponse {
|
|
165
|
+
string revenue = 1; // platform commission earned (period)
|
|
166
|
+
string gmv = 2; // gross merchandise value (period)
|
|
167
|
+
string liabilities = 3; // Σ all users' (pending+payout+spending) — what we owe
|
|
168
|
+
string psp_clearing = 4; // money in transit at PSP
|
|
169
|
+
string payouts_payable = 5; // reserved for approved withdrawals
|
|
170
|
+
string refunds_total = 6;
|
|
171
|
+
string topups_total = 7;
|
|
172
|
+
string withdrawals_total = 8;
|
|
173
|
+
int32 sales_count = 9;
|
|
174
|
+
string currency = 10;
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
message AdminListTransactionsRequest {
|
|
178
|
+
string type = 1;
|
|
179
|
+
string user_id = 2;
|
|
180
|
+
string account_kind = 3;
|
|
181
|
+
string from = 4;
|
|
182
|
+
string to = 5;
|
|
183
|
+
int32 page = 6;
|
|
184
|
+
int32 limit = 7;
|
|
185
|
+
}
|
|
186
|
+
message AdminEntry { string account_id = 1; string account_kind = 2; string owner_id = 3; string direction = 4; string amount = 5; }
|
|
187
|
+
message AdminLedgerTx {
|
|
188
|
+
string id = 1;
|
|
189
|
+
string type = 2;
|
|
190
|
+
string status = 3;
|
|
191
|
+
string ref_type = 4;
|
|
192
|
+
string ref_id = 5;
|
|
193
|
+
string description = 6;
|
|
194
|
+
string created_by = 7;
|
|
195
|
+
string created_at = 8;
|
|
196
|
+
repeated AdminEntry entries = 9;
|
|
197
|
+
}
|
|
198
|
+
message AdminTransactionsListResponse { repeated AdminLedgerTx items = 1; int32 total = 2; int32 page = 3; int32 limit = 4; }
|
|
199
|
+
|
|
200
|
+
message GetUserFinanceRequest { string user_id = 1; }
|
|
201
|
+
message AccountBalance { string kind = 1; string balance = 2; string currency = 3; }
|
|
202
|
+
message UserFinanceResponse {
|
|
203
|
+
WalletResponse wallet = 1;
|
|
204
|
+
repeated AccountBalance accounts = 2;
|
|
205
|
+
repeated StatementEntry recent = 3;
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
message CreateAdjustmentRequest {
|
|
209
|
+
string admin_id = 1;
|
|
210
|
+
string user_id = 2;
|
|
211
|
+
string account_kind = 3; // USER_SPENDING | USER_PAYOUT | USER_PENDING
|
|
212
|
+
string direction = 4; // CREDIT (give) | DEBIT (take)
|
|
213
|
+
string amount = 5;
|
|
214
|
+
string reason = 6;
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
message SalesAnalyticsRequest { string from = 1; string to = 2; string granularity = 3; } // day|week|month
|
|
218
|
+
message SalesPoint { string date = 1; int32 sales_count = 2; string gmv = 3; string revenue = 4; }
|
|
219
|
+
message SellerStat { string seller_id = 1; string username = 2; int32 sales = 3; string gmv = 4; }
|
|
220
|
+
message SalesAnalyticsResponse {
|
|
221
|
+
repeated SalesPoint points = 1;
|
|
222
|
+
repeated SellerStat top_sellers = 2;
|
|
223
|
+
string refund_rate = 3; // % refunded purchases
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
// ---------------------------------------------------------------------------
|
|
227
|
+
// Premium
|
|
228
|
+
// ---------------------------------------------------------------------------
|
|
229
|
+
message GetPremiumPlansRequest {}
|
|
230
|
+
|
|
231
|
+
// One plan per (period). Prices are computed server-side from BASE_PRICE × months
|
|
232
|
+
// × (1 − discount); kept here as canonical strings so the gateway has no math.
|
|
233
|
+
message PremiumPlan {
|
|
234
|
+
string period = 1; // MONTH_1 | MONTH_3 | MONTH_6 | MONTH_12
|
|
235
|
+
int32 months = 2;
|
|
236
|
+
string price = 3; // total to charge, Decimal-as-string
|
|
237
|
+
string monthly_price = 4; // for UI "≈ X ₽/month"
|
|
238
|
+
string discount_percent = 5;
|
|
239
|
+
string currency = 6;
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
message PremiumPlansResponse {
|
|
243
|
+
repeated PremiumPlan plans = 1;
|
|
244
|
+
string base_monthly_price = 2;
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
message PurchasePremiumRequest {
|
|
248
|
+
string user_id = 1;
|
|
249
|
+
string period = 2; // MONTH_1 | MONTH_3 | MONTH_6 | MONTH_12
|
|
250
|
+
string payment_method = 3; // BALANCE | YOOKASSA
|
|
251
|
+
string return_url = 4; // YooKassa only
|
|
252
|
+
// Save the YooKassa payment_method for future auto-renewals. Ignored for
|
|
253
|
+
// BALANCE. Default true — the UI surfaces a checkbox.
|
|
254
|
+
bool save_payment_method = 5;
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
message PurchasePremiumResponse {
|
|
258
|
+
string payment_id = 1; // PremiumPayment.id
|
|
259
|
+
string confirmation_url = 2; // empty for BALANCE (instant) or YooKassa-issued
|
|
260
|
+
string status = 3; // PENDING (redirect) | COMPLETED (balance)
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
message RunPremiumRenewalsRequest {
|
|
264
|
+
int32 max_batch = 1; // safety cap; default 100
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
message RunPremiumRenewalsResponse {
|
|
268
|
+
int32 attempted = 1;
|
|
269
|
+
int32 succeeded = 2;
|
|
270
|
+
int32 failed = 3;
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
message PremiumPaymentRow {
|
|
274
|
+
string id = 1;
|
|
275
|
+
string user_id = 2;
|
|
276
|
+
string amount = 3;
|
|
277
|
+
string period = 4; // MONTH_1 | MONTH_3 | MONTH_6 | MONTH_12
|
|
278
|
+
string method = 5; // BALANCE | YOOKASSA
|
|
279
|
+
string status = 6; // PENDING | COMPLETED | FAILED | REFUNDED
|
|
280
|
+
bool is_renewal = 7;
|
|
281
|
+
string created_at = 8;
|
|
282
|
+
string completed_at = 9;
|
|
283
|
+
string refunded_at = 10;
|
|
284
|
+
string refunded_amount = 11;
|
|
285
|
+
// Convenience: true if this payment is currently inside the 7-day refund
|
|
286
|
+
// window AND status == COMPLETED AND not already refunded.
|
|
287
|
+
bool refundable = 12;
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
message RefundPremiumRequest {
|
|
291
|
+
string user_id = 1;
|
|
292
|
+
string payment_id = 2;
|
|
293
|
+
string reason = 3; // optional
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
message RefundPremiumResponse {
|
|
297
|
+
PremiumPaymentRow payment = 1;
|
|
298
|
+
string new_expires_at = 2; // ISO 8601 after rollback
|
|
299
|
+
bool subscription_revoked = 3; // true when rollback put expiresAt <= now
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
message GetMyPremiumPaymentsRequest {
|
|
303
|
+
string user_id = 1;
|
|
304
|
+
int32 page = 2;
|
|
305
|
+
int32 limit = 3;
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
message PremiumPaymentsListResponse {
|
|
309
|
+
repeated PremiumPaymentRow items = 1;
|
|
310
|
+
int32 total = 2;
|
|
311
|
+
int32 page = 3;
|
|
312
|
+
int32 limit = 4;
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
// ---------------------------------------------------------------------------
|
|
316
|
+
// Saved cards (YooKassa payment_method tokens; we never see PAN)
|
|
317
|
+
// ---------------------------------------------------------------------------
|
|
318
|
+
message SavedCard {
|
|
319
|
+
string id = 1;
|
|
320
|
+
string brand = 2; // "MIR" | "VISA" | "MASTERCARD" | ""
|
|
321
|
+
string last4 = 3; // "0000" etc, display-only
|
|
322
|
+
int32 exp_month = 4;
|
|
323
|
+
int32 exp_year = 5;
|
|
324
|
+
bool is_default = 6;
|
|
325
|
+
string nickname = 7; // user-set label
|
|
326
|
+
string created_at = 8;
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
message ListSavedCardsRequest { string user_id = 1; }
|
|
330
|
+
message ListSavedCardsResponse { repeated SavedCard items = 1; }
|
|
331
|
+
|
|
332
|
+
message DeleteSavedCardRequest { string user_id = 1; string id = 2; }
|
|
333
|
+
|
|
334
|
+
message SetDefaultSavedCardRequest { string user_id = 1; string id = 2; }
|
|
335
|
+
|
|
336
|
+
message UpdateSavedCardRequest {
|
|
337
|
+
string user_id = 1;
|
|
338
|
+
string id = 2;
|
|
339
|
+
string nickname = 3; // empty = clear
|
|
340
|
+
}
|
|
341
|
+
|
|
342
|
+
// ---------------------------------------------------------------------------
|
|
343
|
+
// Payout details (persistent default; per-withdrawal override still allowed)
|
|
344
|
+
// ---------------------------------------------------------------------------
|
|
345
|
+
message UpdatePayoutDetailsRequest {
|
|
346
|
+
string user_id = 1;
|
|
347
|
+
string method = 2; // "card" | "sbp" | "bank" | "" (clear)
|
|
348
|
+
string details = 3; // JSON string — payments-service treats opaquely
|
|
349
|
+
}
|
|
350
|
+
|
|
351
|
+
message UpdatePayoutDetailsResponse {
|
|
352
|
+
string method = 1;
|
|
353
|
+
string details = 2;
|
|
354
|
+
}
|
|
355
|
+
|
|
356
|
+
message GetPayoutDetailsRequest { string user_id = 1; }
|