@aepstore-dev/contracts 1.42.1 → 1.43.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.
@@ -0,0 +1,828 @@
1
+ // Code generated by protoc-gen-ts_proto. DO NOT EDIT.
2
+ // versions:
3
+ // protoc-gen-ts_proto v2.10.1
4
+ // protoc v7.35.0
5
+ // source: payments.proto
6
+
7
+ /* eslint-disable */
8
+ import { GrpcMethod, GrpcStreamMethod } from "@nestjs/microservices";
9
+ import { Observable } from "rxjs";
10
+
11
+ export const protobufPackage = "payments.v1";
12
+
13
+ export interface Ok {
14
+ ok: boolean;
15
+ }
16
+
17
+ /**
18
+ * ---------------------------------------------------------------------------
19
+ * Purchase / checkout / topup
20
+ * ---------------------------------------------------------------------------
21
+ */
22
+ export interface Purchase {
23
+ id: string;
24
+ productId: string;
25
+ productName: string;
26
+ userId: string;
27
+ price: string;
28
+ /** PENDING | COMPLETED | FAILED | REFUNDED */
29
+ status: string;
30
+ paymentId: string;
31
+ /** BALANCE | YOOKASSA */
32
+ paymentMethod: string;
33
+ commissionPercent: string;
34
+ sellerAmount: string;
35
+ createdAt: string;
36
+ completedAt: string;
37
+ }
38
+
39
+ export interface TopupRequest {
40
+ userId: string;
41
+ /** >= 10.00 */
42
+ amount: string;
43
+ returnUrl: string;
44
+ }
45
+
46
+ export interface CreateCheckoutRequest {
47
+ userId: string;
48
+ productId: string;
49
+ /** BALANCE | YOOKASSA (default YOOKASSA) */
50
+ paymentMethod: string;
51
+ returnUrl: string;
52
+ }
53
+
54
+ export interface CheckoutResponse {
55
+ purchaseId: string;
56
+ paymentId: string;
57
+ /** empty when paid from balance (instant) */
58
+ confirmationUrl: string;
59
+ /** PENDING (redirect) | COMPLETED (balance) */
60
+ status: string;
61
+ }
62
+
63
+ export interface GetMyPurchasesRequest {
64
+ userId: string;
65
+ page: number;
66
+ limit: number;
67
+ }
68
+
69
+ export interface PurchasesListResponse {
70
+ items: Purchase[];
71
+ total: number;
72
+ page: number;
73
+ limit: number;
74
+ }
75
+
76
+ export interface GetPurchaseRequest {
77
+ id: string;
78
+ userId: string;
79
+ }
80
+
81
+ export interface RefundPurchaseRequest {
82
+ purchaseId: string;
83
+ actorUserId: string;
84
+ isAdmin: boolean;
85
+ reason: string;
86
+ }
87
+
88
+ /**
89
+ * ---------------------------------------------------------------------------
90
+ * Wallet & statement
91
+ * ---------------------------------------------------------------------------
92
+ */
93
+ export interface GetWalletRequest {
94
+ userId: string;
95
+ }
96
+
97
+ export interface WalletResponse {
98
+ spending: string;
99
+ pending: string;
100
+ payout: string;
101
+ /** spending + payout */
102
+ spendable: string;
103
+ /** payout */
104
+ withdrawable: string;
105
+ currency: string;
106
+ lifetimeSales: number;
107
+ currentCommissionPercent: string;
108
+ }
109
+
110
+ export interface ListTransactionsRequest {
111
+ userId: string;
112
+ /**
113
+ * Legacy low-level filter (one of LedgerTxType). Kept for backward
114
+ * compatibility — admin tooling still uses it directly.
115
+ */
116
+ type: string;
117
+ page: number;
118
+ limit: number;
119
+ /**
120
+ * ↓ added for the wallet statement page (Round 3)
121
+ * UI-semantic filter mapped onto displayKind:
122
+ * ALL | SALES | INCOME | OUTCOME | REFUND | WITHDRAWAL | PREMIUM
123
+ * SALES = the seller's earnings on this account (USER_PENDING credits from
124
+ * PURCHASE transactions); these stay separate from INCOME (TOPUP).
125
+ */
126
+ flow: string;
127
+ /**
128
+ * Period selection. `month` is the convenience form (YYYY-MM) used by the
129
+ * month dropdown; from/to override it for an arbitrary range.
130
+ */
131
+ month: string;
132
+ from: string;
133
+ to: string;
134
+ /**
135
+ * Filter wallet to purchases/refunds of a specific Product category. Has
136
+ * no effect on TOPUP/WITHDRAWAL/PREMIUM/ADJUSTMENT entries (they have no
137
+ * product).
138
+ */
139
+ productCategoryId: string;
140
+ /** sort_by ∈ { date | amount | type }. Default: date. */
141
+ sortBy: string;
142
+ /** order ∈ { asc | desc }. Default: desc. */
143
+ order: string;
144
+ }
145
+
146
+ export interface StatementEntry {
147
+ id: string;
148
+ txId: string;
149
+ /** raw tx type (TOPUP|PURCHASE|...) */
150
+ type: string;
151
+ accountKind: string;
152
+ /** DEBIT | CREDIT */
153
+ direction: string;
154
+ amount: string;
155
+ description: string;
156
+ createdAt: string;
157
+ /**
158
+ * ↓ added for the wallet statement page (Round 3)
159
+ * UI-friendly classification computed server-side:
160
+ * TOPUP | PURCHASE | SALE | REFUND | PREMIUM | WITHDRAWAL | ADJUSTMENT
161
+ * SALE is the seller's view of someone else's PURCHASE (CREDIT to their
162
+ * USER_PENDING) — distinct from PURCHASE which is the buyer's DEBIT.
163
+ * PREMIUM is split out of PURCHASE/REFUND so the UI can show
164
+ * "Продление Premium" / refund-of-premium in their own filter bucket.
165
+ * SALE_CLEAR transactions are excluded from the wallet view — the maturity
166
+ * event is surfaced via sale_status on the original SALE row instead.
167
+ */
168
+ displayKind: string;
169
+ /** affected-account running balance, Decimal-as-string */
170
+ balanceAfter: string;
171
+ /** empty for non-product entries */
172
+ productId: string;
173
+ productName: string;
174
+ /** "Assets" | "Project File" | "Templates" */
175
+ productCategory: string;
176
+ /** optional thumbnail URL for richer rows */
177
+ productPreview: string;
178
+ /**
179
+ * Sale lifecycle. Populated only when display_kind=SALE.
180
+ * PENDING — held in USER_PENDING, not yet withdrawable.
181
+ * MATURED — SALE_CLEAR has fired; money is in USER_PAYOUT.
182
+ */
183
+ saleStatus: string;
184
+ /**
185
+ * ISO 8601 when the sale becomes withdrawable (sale_completed_at +
186
+ * GRACE_DAYS). Empty for non-sale rows.
187
+ */
188
+ maturesAt: string;
189
+ }
190
+
191
+ export interface TransactionsListResponse {
192
+ items: StatementEntry[];
193
+ total: number;
194
+ page: number;
195
+ limit: number;
196
+ }
197
+
198
+ export interface GetTransactionMonthsRequest {
199
+ userId: string;
200
+ }
201
+
202
+ export interface GetTransactionMonthsResponse {
203
+ /**
204
+ * Newest first. "YYYY-MM" strings; the dropdown renders them
205
+ * localized client-side.
206
+ */
207
+ months: string[];
208
+ }
209
+
210
+ /**
211
+ * ---------------------------------------------------------------------------
212
+ * Withdrawals
213
+ * ---------------------------------------------------------------------------
214
+ */
215
+ export interface Withdrawal {
216
+ id: string;
217
+ sellerId: string;
218
+ amount: string;
219
+ /** PENDING | PROCESSING | COMPLETED | REJECTED */
220
+ status: string;
221
+ method: string;
222
+ details: string;
223
+ comment: string;
224
+ processedBy: string;
225
+ processedAt: string;
226
+ createdAt: string;
227
+ }
228
+
229
+ export interface RequestWithdrawalRequest {
230
+ sellerId: string;
231
+ amount: string;
232
+ method: string;
233
+ details: string;
234
+ }
235
+
236
+ export interface ListWithdrawalsRequest {
237
+ sellerId: string;
238
+ status: string;
239
+ page: number;
240
+ limit: number;
241
+ }
242
+
243
+ export interface WithdrawalsListResponse {
244
+ items: Withdrawal[];
245
+ total: number;
246
+ page: number;
247
+ limit: number;
248
+ }
249
+
250
+ export interface ProcessWithdrawalRequest {
251
+ withdrawalId: string;
252
+ adminId: string;
253
+ action: string;
254
+ comment: string;
255
+ }
256
+
257
+ /**
258
+ * ---------------------------------------------------------------------------
259
+ * Webhook
260
+ * ---------------------------------------------------------------------------
261
+ */
262
+ export interface PaymentEventRequest {
263
+ event: string;
264
+ paymentId: string;
265
+ }
266
+
267
+ /**
268
+ * ---------------------------------------------------------------------------
269
+ * Admin
270
+ * ---------------------------------------------------------------------------
271
+ */
272
+ export interface AdminOverviewRequest {
273
+ from: string;
274
+ to: string;
275
+ }
276
+
277
+ export interface AdminOverviewResponse {
278
+ /** platform commission earned (period) */
279
+ revenue: string;
280
+ /** gross merchandise value (period) */
281
+ gmv: string;
282
+ /** Σ all users' (pending+payout+spending) — what we owe */
283
+ liabilities: string;
284
+ /** money in transit at PSP */
285
+ pspClearing: string;
286
+ /** reserved for approved withdrawals */
287
+ payoutsPayable: string;
288
+ refundsTotal: string;
289
+ topupsTotal: string;
290
+ withdrawalsTotal: string;
291
+ salesCount: number;
292
+ currency: string;
293
+ }
294
+
295
+ export interface AdminListTransactionsRequest {
296
+ type: string;
297
+ userId: string;
298
+ accountKind: string;
299
+ from: string;
300
+ to: string;
301
+ page: number;
302
+ limit: number;
303
+ }
304
+
305
+ export interface AdminEntry {
306
+ accountId: string;
307
+ accountKind: string;
308
+ ownerId: string;
309
+ direction: string;
310
+ amount: string;
311
+ }
312
+
313
+ export interface AdminLedgerTx {
314
+ id: string;
315
+ type: string;
316
+ status: string;
317
+ refType: string;
318
+ refId: string;
319
+ description: string;
320
+ createdBy: string;
321
+ createdAt: string;
322
+ entries: AdminEntry[];
323
+ }
324
+
325
+ export interface AdminTransactionsListResponse {
326
+ items: AdminLedgerTx[];
327
+ total: number;
328
+ page: number;
329
+ limit: number;
330
+ }
331
+
332
+ export interface GetUserFinanceRequest {
333
+ userId: string;
334
+ }
335
+
336
+ export interface AccountBalance {
337
+ kind: string;
338
+ balance: string;
339
+ currency: string;
340
+ }
341
+
342
+ export interface UserFinanceResponse {
343
+ wallet: WalletResponse | undefined;
344
+ accounts: AccountBalance[];
345
+ recent: StatementEntry[];
346
+ }
347
+
348
+ export interface CreateAdjustmentRequest {
349
+ adminId: string;
350
+ userId: string;
351
+ /** USER_SPENDING | USER_PAYOUT | USER_PENDING */
352
+ accountKind: string;
353
+ /** CREDIT (give) | DEBIT (take) */
354
+ direction: string;
355
+ amount: string;
356
+ reason: string;
357
+ }
358
+
359
+ export interface SalesAnalyticsRequest {
360
+ from: string;
361
+ to: string;
362
+ granularity: string;
363
+ }
364
+
365
+ export interface SalesPoint {
366
+ date: string;
367
+ salesCount: number;
368
+ gmv: string;
369
+ revenue: string;
370
+ }
371
+
372
+ export interface SellerStat {
373
+ sellerId: string;
374
+ username: string;
375
+ sales: number;
376
+ gmv: string;
377
+ }
378
+
379
+ export interface SalesAnalyticsResponse {
380
+ points: SalesPoint[];
381
+ topSellers: SellerStat[];
382
+ /** % refunded purchases */
383
+ refundRate: string;
384
+ }
385
+
386
+ /**
387
+ * ---------------------------------------------------------------------------
388
+ * Premium
389
+ * ---------------------------------------------------------------------------
390
+ */
391
+ export interface GetPremiumPlansRequest {
392
+ }
393
+
394
+ /**
395
+ * One plan per (period). Prices are computed server-side from BASE_PRICE × months
396
+ * × (1 − discount); kept here as canonical strings so the gateway has no math.
397
+ */
398
+ export interface PremiumPlan {
399
+ /** MONTH_1 | MONTH_3 | MONTH_6 | MONTH_12 */
400
+ period: string;
401
+ months: number;
402
+ /** total to charge, Decimal-as-string */
403
+ price: string;
404
+ /** for UI "≈ X ₽/month" */
405
+ monthlyPrice: string;
406
+ discountPercent: string;
407
+ currency: string;
408
+ }
409
+
410
+ export interface PremiumPlansResponse {
411
+ plans: PremiumPlan[];
412
+ baseMonthlyPrice: string;
413
+ }
414
+
415
+ export interface PurchasePremiumRequest {
416
+ userId: string;
417
+ /** MONTH_1 | MONTH_3 | MONTH_6 | MONTH_12 */
418
+ period: string;
419
+ /** BALANCE | YOOKASSA */
420
+ paymentMethod: string;
421
+ /** YooKassa only */
422
+ returnUrl: string;
423
+ /**
424
+ * Save the YooKassa payment_method for future auto-renewals. Ignored for
425
+ * BALANCE. Default true — the UI surfaces a checkbox.
426
+ */
427
+ savePaymentMethod: boolean;
428
+ }
429
+
430
+ export interface PurchasePremiumResponse {
431
+ /** PremiumPayment.id */
432
+ paymentId: string;
433
+ /** empty for BALANCE (instant) or YooKassa-issued */
434
+ confirmationUrl: string;
435
+ /** PENDING (redirect) | COMPLETED (balance) */
436
+ status: string;
437
+ }
438
+
439
+ export interface RunPremiumRenewalsRequest {
440
+ /** safety cap; default 100 */
441
+ maxBatch: number;
442
+ }
443
+
444
+ export interface RunPremiumRenewalsResponse {
445
+ attempted: number;
446
+ succeeded: number;
447
+ failed: number;
448
+ }
449
+
450
+ export interface PremiumPaymentRow {
451
+ id: string;
452
+ userId: string;
453
+ amount: string;
454
+ /** MONTH_1 | MONTH_3 | MONTH_6 | MONTH_12 */
455
+ period: string;
456
+ /** BALANCE | YOOKASSA */
457
+ method: string;
458
+ /** PENDING | COMPLETED | FAILED | REFUNDED */
459
+ status: string;
460
+ isRenewal: boolean;
461
+ createdAt: string;
462
+ completedAt: string;
463
+ refundedAt: string;
464
+ refundedAmount: string;
465
+ /**
466
+ * Convenience: true if this payment is currently inside the 7-day refund
467
+ * window AND status == COMPLETED AND not already refunded.
468
+ */
469
+ refundable: boolean;
470
+ }
471
+
472
+ export interface RefundPremiumRequest {
473
+ userId: string;
474
+ paymentId: string;
475
+ /** optional */
476
+ reason: string;
477
+ }
478
+
479
+ export interface RefundPremiumResponse {
480
+ payment:
481
+ | PremiumPaymentRow
482
+ | undefined;
483
+ /** ISO 8601 after rollback */
484
+ newExpiresAt: string;
485
+ /** true when rollback put expiresAt <= now */
486
+ subscriptionRevoked: boolean;
487
+ }
488
+
489
+ export interface GetMyPremiumPaymentsRequest {
490
+ userId: string;
491
+ page: number;
492
+ limit: number;
493
+ }
494
+
495
+ export interface PremiumPaymentsListResponse {
496
+ items: PremiumPaymentRow[];
497
+ total: number;
498
+ page: number;
499
+ limit: number;
500
+ }
501
+
502
+ /**
503
+ * ---------------------------------------------------------------------------
504
+ * Saved cards (YooKassa payment_method tokens; we never see PAN)
505
+ * ---------------------------------------------------------------------------
506
+ */
507
+ export interface SavedCard {
508
+ id: string;
509
+ /** "MIR" | "VISA" | "MASTERCARD" | "" */
510
+ brand: string;
511
+ /** "0000" etc, display-only */
512
+ last4: string;
513
+ expMonth: number;
514
+ expYear: number;
515
+ isDefault: boolean;
516
+ /** user-set label */
517
+ nickname: string;
518
+ createdAt: string;
519
+ }
520
+
521
+ export interface ListSavedCardsRequest {
522
+ userId: string;
523
+ }
524
+
525
+ export interface ListSavedCardsResponse {
526
+ items: SavedCard[];
527
+ }
528
+
529
+ export interface DeleteSavedCardRequest {
530
+ userId: string;
531
+ id: string;
532
+ }
533
+
534
+ export interface SetDefaultSavedCardRequest {
535
+ userId: string;
536
+ id: string;
537
+ }
538
+
539
+ export interface UpdateSavedCardRequest {
540
+ userId: string;
541
+ id: string;
542
+ /** empty = clear */
543
+ nickname: string;
544
+ }
545
+
546
+ /**
547
+ * ---------------------------------------------------------------------------
548
+ * Payout details (persistent default; per-withdrawal override still allowed)
549
+ * ---------------------------------------------------------------------------
550
+ */
551
+ export interface UpdatePayoutDetailsRequest {
552
+ userId: string;
553
+ /** "card" | "sbp" | "bank" | "" (clear) */
554
+ method: string;
555
+ /** JSON string — payments-service treats opaquely */
556
+ details: string;
557
+ }
558
+
559
+ export interface UpdatePayoutDetailsResponse {
560
+ method: string;
561
+ details: string;
562
+ }
563
+
564
+ export interface GetPayoutDetailsRequest {
565
+ userId: string;
566
+ }
567
+
568
+ export const PAYMENTS_V1_PACKAGE_NAME = "payments.v1";
569
+
570
+ /**
571
+ * Commerce + double-entry wallet/ledger (D9 / D9.2). See payments-service/docs/FINANCE.md.
572
+ * Money = Decimal-as-string (D7). Statuses/enums as strings (avoid proto enum
573
+ * value-name clashes within one package).
574
+ */
575
+
576
+ export interface PaymentsServiceClient {
577
+ /** ----- buyer ----- */
578
+
579
+ topup(request: TopupRequest): Observable<CheckoutResponse>;
580
+
581
+ createCheckout(request: CreateCheckoutRequest): Observable<CheckoutResponse>;
582
+
583
+ getMyPurchases(request: GetMyPurchasesRequest): Observable<PurchasesListResponse>;
584
+
585
+ getPurchase(request: GetPurchaseRequest): Observable<Purchase>;
586
+
587
+ refundPurchase(request: RefundPurchaseRequest): Observable<Purchase>;
588
+
589
+ /** ----- wallet ----- */
590
+
591
+ getWallet(request: GetWalletRequest): Observable<WalletResponse>;
592
+
593
+ listTransactions(request: ListTransactionsRequest): Observable<TransactionsListResponse>;
594
+
595
+ getTransactionMonths(request: GetTransactionMonthsRequest): Observable<GetTransactionMonthsResponse>;
596
+
597
+ /** ----- withdrawals ----- */
598
+
599
+ requestWithdrawal(request: RequestWithdrawalRequest): Observable<Withdrawal>;
600
+
601
+ listWithdrawals(request: ListWithdrawalsRequest): Observable<WithdrawalsListResponse>;
602
+
603
+ processWithdrawal(request: ProcessWithdrawalRequest): Observable<Withdrawal>;
604
+
605
+ /** ----- provider webhook (gateway forwards a verified event) ----- */
606
+
607
+ handlePaymentEvent(request: PaymentEventRequest): Observable<Ok>;
608
+
609
+ /** ----- premium ----- */
610
+
611
+ getPremiumPlans(request: GetPremiumPlansRequest): Observable<PremiumPlansResponse>;
612
+
613
+ purchasePremium(request: PurchasePremiumRequest): Observable<PurchasePremiumResponse>;
614
+
615
+ /**
616
+ * 7-day refund window from completedAt. Reverses ledger, calls YooKassa for
617
+ * card purchases, rolls back the subscription's expiresAt by the period.
618
+ */
619
+
620
+ refundPremium(request: RefundPremiumRequest): Observable<RefundPremiumResponse>;
621
+
622
+ getMyPremiumPayments(request: GetMyPremiumPaymentsRequest): Observable<PremiumPaymentsListResponse>;
623
+
624
+ /**
625
+ * Internal — InternalServiceGuard. tasks-service cron triggers due renewals;
626
+ * payments-service iterates ACTIVE subscriptions with autoRenew+savedCard.
627
+ */
628
+
629
+ runPremiumRenewals(request: RunPremiumRenewalsRequest): Observable<RunPremiumRenewalsResponse>;
630
+
631
+ /** ----- saved cards ----- */
632
+
633
+ listSavedCards(request: ListSavedCardsRequest): Observable<ListSavedCardsResponse>;
634
+
635
+ deleteSavedCard(request: DeleteSavedCardRequest): Observable<Ok>;
636
+
637
+ setDefaultSavedCard(request: SetDefaultSavedCardRequest): Observable<SavedCard>;
638
+
639
+ updateSavedCard(request: UpdateSavedCardRequest): Observable<SavedCard>;
640
+
641
+ /** ----- payout details ----- */
642
+
643
+ updatePayoutDetails(request: UpdatePayoutDetailsRequest): Observable<UpdatePayoutDetailsResponse>;
644
+
645
+ getPayoutDetails(request: GetPayoutDetailsRequest): Observable<UpdatePayoutDetailsResponse>;
646
+
647
+ /** ----- admin ----- */
648
+
649
+ getAdminOverview(request: AdminOverviewRequest): Observable<AdminOverviewResponse>;
650
+
651
+ adminListTransactions(request: AdminListTransactionsRequest): Observable<AdminTransactionsListResponse>;
652
+
653
+ getUserFinance(request: GetUserFinanceRequest): Observable<UserFinanceResponse>;
654
+
655
+ createAdjustment(request: CreateAdjustmentRequest): Observable<Ok>;
656
+
657
+ getSalesAnalytics(request: SalesAnalyticsRequest): Observable<SalesAnalyticsResponse>;
658
+ }
659
+
660
+ /**
661
+ * Commerce + double-entry wallet/ledger (D9 / D9.2). See payments-service/docs/FINANCE.md.
662
+ * Money = Decimal-as-string (D7). Statuses/enums as strings (avoid proto enum
663
+ * value-name clashes within one package).
664
+ */
665
+
666
+ export interface PaymentsServiceController {
667
+ /** ----- buyer ----- */
668
+
669
+ topup(request: TopupRequest): Promise<CheckoutResponse> | Observable<CheckoutResponse> | CheckoutResponse;
670
+
671
+ createCheckout(
672
+ request: CreateCheckoutRequest,
673
+ ): Promise<CheckoutResponse> | Observable<CheckoutResponse> | CheckoutResponse;
674
+
675
+ getMyPurchases(
676
+ request: GetMyPurchasesRequest,
677
+ ): Promise<PurchasesListResponse> | Observable<PurchasesListResponse> | PurchasesListResponse;
678
+
679
+ getPurchase(request: GetPurchaseRequest): Promise<Purchase> | Observable<Purchase> | Purchase;
680
+
681
+ refundPurchase(request: RefundPurchaseRequest): Promise<Purchase> | Observable<Purchase> | Purchase;
682
+
683
+ /** ----- wallet ----- */
684
+
685
+ getWallet(request: GetWalletRequest): Promise<WalletResponse> | Observable<WalletResponse> | WalletResponse;
686
+
687
+ listTransactions(
688
+ request: ListTransactionsRequest,
689
+ ): Promise<TransactionsListResponse> | Observable<TransactionsListResponse> | TransactionsListResponse;
690
+
691
+ getTransactionMonths(
692
+ request: GetTransactionMonthsRequest,
693
+ ): Promise<GetTransactionMonthsResponse> | Observable<GetTransactionMonthsResponse> | GetTransactionMonthsResponse;
694
+
695
+ /** ----- withdrawals ----- */
696
+
697
+ requestWithdrawal(request: RequestWithdrawalRequest): Promise<Withdrawal> | Observable<Withdrawal> | Withdrawal;
698
+
699
+ listWithdrawals(
700
+ request: ListWithdrawalsRequest,
701
+ ): Promise<WithdrawalsListResponse> | Observable<WithdrawalsListResponse> | WithdrawalsListResponse;
702
+
703
+ processWithdrawal(request: ProcessWithdrawalRequest): Promise<Withdrawal> | Observable<Withdrawal> | Withdrawal;
704
+
705
+ /** ----- provider webhook (gateway forwards a verified event) ----- */
706
+
707
+ handlePaymentEvent(request: PaymentEventRequest): Promise<Ok> | Observable<Ok> | Ok;
708
+
709
+ /** ----- premium ----- */
710
+
711
+ getPremiumPlans(
712
+ request: GetPremiumPlansRequest,
713
+ ): Promise<PremiumPlansResponse> | Observable<PremiumPlansResponse> | PremiumPlansResponse;
714
+
715
+ purchasePremium(
716
+ request: PurchasePremiumRequest,
717
+ ): Promise<PurchasePremiumResponse> | Observable<PurchasePremiumResponse> | PurchasePremiumResponse;
718
+
719
+ /**
720
+ * 7-day refund window from completedAt. Reverses ledger, calls YooKassa for
721
+ * card purchases, rolls back the subscription's expiresAt by the period.
722
+ */
723
+
724
+ refundPremium(
725
+ request: RefundPremiumRequest,
726
+ ): Promise<RefundPremiumResponse> | Observable<RefundPremiumResponse> | RefundPremiumResponse;
727
+
728
+ getMyPremiumPayments(
729
+ request: GetMyPremiumPaymentsRequest,
730
+ ): Promise<PremiumPaymentsListResponse> | Observable<PremiumPaymentsListResponse> | PremiumPaymentsListResponse;
731
+
732
+ /**
733
+ * Internal — InternalServiceGuard. tasks-service cron triggers due renewals;
734
+ * payments-service iterates ACTIVE subscriptions with autoRenew+savedCard.
735
+ */
736
+
737
+ runPremiumRenewals(
738
+ request: RunPremiumRenewalsRequest,
739
+ ): Promise<RunPremiumRenewalsResponse> | Observable<RunPremiumRenewalsResponse> | RunPremiumRenewalsResponse;
740
+
741
+ /** ----- saved cards ----- */
742
+
743
+ listSavedCards(
744
+ request: ListSavedCardsRequest,
745
+ ): Promise<ListSavedCardsResponse> | Observable<ListSavedCardsResponse> | ListSavedCardsResponse;
746
+
747
+ deleteSavedCard(request: DeleteSavedCardRequest): Promise<Ok> | Observable<Ok> | Ok;
748
+
749
+ setDefaultSavedCard(request: SetDefaultSavedCardRequest): Promise<SavedCard> | Observable<SavedCard> | SavedCard;
750
+
751
+ updateSavedCard(request: UpdateSavedCardRequest): Promise<SavedCard> | Observable<SavedCard> | SavedCard;
752
+
753
+ /** ----- payout details ----- */
754
+
755
+ updatePayoutDetails(
756
+ request: UpdatePayoutDetailsRequest,
757
+ ): Promise<UpdatePayoutDetailsResponse> | Observable<UpdatePayoutDetailsResponse> | UpdatePayoutDetailsResponse;
758
+
759
+ getPayoutDetails(
760
+ request: GetPayoutDetailsRequest,
761
+ ): Promise<UpdatePayoutDetailsResponse> | Observable<UpdatePayoutDetailsResponse> | UpdatePayoutDetailsResponse;
762
+
763
+ /** ----- admin ----- */
764
+
765
+ getAdminOverview(
766
+ request: AdminOverviewRequest,
767
+ ): Promise<AdminOverviewResponse> | Observable<AdminOverviewResponse> | AdminOverviewResponse;
768
+
769
+ adminListTransactions(
770
+ request: AdminListTransactionsRequest,
771
+ ): Promise<AdminTransactionsListResponse> | Observable<AdminTransactionsListResponse> | AdminTransactionsListResponse;
772
+
773
+ getUserFinance(
774
+ request: GetUserFinanceRequest,
775
+ ): Promise<UserFinanceResponse> | Observable<UserFinanceResponse> | UserFinanceResponse;
776
+
777
+ createAdjustment(request: CreateAdjustmentRequest): Promise<Ok> | Observable<Ok> | Ok;
778
+
779
+ getSalesAnalytics(
780
+ request: SalesAnalyticsRequest,
781
+ ): Promise<SalesAnalyticsResponse> | Observable<SalesAnalyticsResponse> | SalesAnalyticsResponse;
782
+ }
783
+
784
+ export function PaymentsServiceControllerMethods() {
785
+ return function (constructor: Function) {
786
+ const grpcMethods: string[] = [
787
+ "topup",
788
+ "createCheckout",
789
+ "getMyPurchases",
790
+ "getPurchase",
791
+ "refundPurchase",
792
+ "getWallet",
793
+ "listTransactions",
794
+ "getTransactionMonths",
795
+ "requestWithdrawal",
796
+ "listWithdrawals",
797
+ "processWithdrawal",
798
+ "handlePaymentEvent",
799
+ "getPremiumPlans",
800
+ "purchasePremium",
801
+ "refundPremium",
802
+ "getMyPremiumPayments",
803
+ "runPremiumRenewals",
804
+ "listSavedCards",
805
+ "deleteSavedCard",
806
+ "setDefaultSavedCard",
807
+ "updateSavedCard",
808
+ "updatePayoutDetails",
809
+ "getPayoutDetails",
810
+ "getAdminOverview",
811
+ "adminListTransactions",
812
+ "getUserFinance",
813
+ "createAdjustment",
814
+ "getSalesAnalytics",
815
+ ];
816
+ for (const method of grpcMethods) {
817
+ const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
818
+ GrpcMethod("PaymentsService", method)(constructor.prototype[method], method, descriptor);
819
+ }
820
+ const grpcStreamMethods: string[] = [];
821
+ for (const method of grpcStreamMethods) {
822
+ const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
823
+ GrpcStreamMethod("PaymentsService", method)(constructor.prototype[method], method, descriptor);
824
+ }
825
+ };
826
+ }
827
+
828
+ export const PAYMENTS_SERVICE_NAME = "PaymentsService";