@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 CHANGED
@@ -119,6 +119,20 @@ export interface TwoFactorStatusResponse {
119
119
  export interface Empty {
120
120
  }
121
121
 
122
+ export interface LogoutCurrentRequest {
123
+ refreshToken: string;
124
+ }
125
+
126
+ export interface LogoutAllRequest {
127
+ userId: string;
128
+ }
129
+
130
+ export interface LogoutResponse {
131
+ ok: boolean;
132
+ /** number of refresh-token rows deleted */
133
+ removed: number;
134
+ }
135
+
122
136
  export const AUTH_V1_PACKAGE_NAME = "auth.v1";
123
137
 
124
138
  /**
@@ -148,6 +162,15 @@ export interface AuthServiceClient {
148
162
  getProfile(request: GetProfileRequest): Observable<AuthUser>;
149
163
 
150
164
  cleanupExpiredTotpSetups(request: Empty): Observable<Empty>;
165
+
166
+ /**
167
+ * Logout — kill refresh tokens. LogoutCurrent kills only the one whose
168
+ * HMAC matches; LogoutAll wipes every row for the user.
169
+ */
170
+
171
+ logoutCurrent(request: LogoutCurrentRequest): Observable<LogoutResponse>;
172
+
173
+ logoutAll(request: LogoutAllRequest): Observable<LogoutResponse>;
151
174
  }
152
175
 
153
176
  /**
@@ -179,6 +202,15 @@ export interface AuthServiceController {
179
202
  getProfile(request: GetProfileRequest): Promise<AuthUser> | Observable<AuthUser> | AuthUser;
180
203
 
181
204
  cleanupExpiredTotpSetups(request: Empty): Promise<Empty> | Observable<Empty> | Empty;
205
+
206
+ /**
207
+ * Logout — kill refresh tokens. LogoutCurrent kills only the one whose
208
+ * HMAC matches; LogoutAll wipes every row for the user.
209
+ */
210
+
211
+ logoutCurrent(request: LogoutCurrentRequest): Promise<LogoutResponse> | Observable<LogoutResponse> | LogoutResponse;
212
+
213
+ logoutAll(request: LogoutAllRequest): Promise<LogoutResponse> | Observable<LogoutResponse> | LogoutResponse;
182
214
  }
183
215
 
184
216
  export function AuthServiceControllerMethods() {
@@ -193,6 +225,8 @@ export function AuthServiceControllerMethods() {
193
225
  "get2FaStatus",
194
226
  "getProfile",
195
227
  "cleanupExpiredTotpSetups",
228
+ "logoutCurrent",
229
+ "logoutAll",
196
230
  ];
197
231
  for (const method of grpcMethods) {
198
232
  const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
package/gen/payments.ts CHANGED
@@ -313,6 +313,188 @@ export interface SalesAnalyticsResponse {
313
313
  refundRate: string;
314
314
  }
315
315
 
316
+ /**
317
+ * ---------------------------------------------------------------------------
318
+ * Premium
319
+ * ---------------------------------------------------------------------------
320
+ */
321
+ export interface GetPremiumPlansRequest {
322
+ }
323
+
324
+ /**
325
+ * One plan per (period). Prices are computed server-side from BASE_PRICE × months
326
+ * × (1 − discount); kept here as canonical strings so the gateway has no math.
327
+ */
328
+ export interface PremiumPlan {
329
+ /** MONTH_1 | MONTH_3 | MONTH_6 | MONTH_12 */
330
+ period: string;
331
+ months: number;
332
+ /** total to charge, Decimal-as-string */
333
+ price: string;
334
+ /** for UI "≈ X ₽/month" */
335
+ monthlyPrice: string;
336
+ discountPercent: string;
337
+ currency: string;
338
+ }
339
+
340
+ export interface PremiumPlansResponse {
341
+ plans: PremiumPlan[];
342
+ baseMonthlyPrice: string;
343
+ }
344
+
345
+ export interface PurchasePremiumRequest {
346
+ userId: string;
347
+ /** MONTH_1 | MONTH_3 | MONTH_6 | MONTH_12 */
348
+ period: string;
349
+ /** BALANCE | YOOKASSA */
350
+ paymentMethod: string;
351
+ /** YooKassa only */
352
+ returnUrl: string;
353
+ /**
354
+ * Save the YooKassa payment_method for future auto-renewals. Ignored for
355
+ * BALANCE. Default true — the UI surfaces a checkbox.
356
+ */
357
+ savePaymentMethod: boolean;
358
+ }
359
+
360
+ export interface PurchasePremiumResponse {
361
+ /** PremiumPayment.id */
362
+ paymentId: string;
363
+ /** empty for BALANCE (instant) or YooKassa-issued */
364
+ confirmationUrl: string;
365
+ /** PENDING (redirect) | COMPLETED (balance) */
366
+ status: string;
367
+ }
368
+
369
+ export interface RunPremiumRenewalsRequest {
370
+ /** safety cap; default 100 */
371
+ maxBatch: number;
372
+ }
373
+
374
+ export interface RunPremiumRenewalsResponse {
375
+ attempted: number;
376
+ succeeded: number;
377
+ failed: number;
378
+ }
379
+
380
+ export interface PremiumPaymentRow {
381
+ id: string;
382
+ userId: string;
383
+ amount: string;
384
+ /** MONTH_1 | MONTH_3 | MONTH_6 | MONTH_12 */
385
+ period: string;
386
+ /** BALANCE | YOOKASSA */
387
+ method: string;
388
+ /** PENDING | COMPLETED | FAILED | REFUNDED */
389
+ status: string;
390
+ isRenewal: boolean;
391
+ createdAt: string;
392
+ completedAt: string;
393
+ refundedAt: string;
394
+ refundedAmount: string;
395
+ /**
396
+ * Convenience: true if this payment is currently inside the 7-day refund
397
+ * window AND status == COMPLETED AND not already refunded.
398
+ */
399
+ refundable: boolean;
400
+ }
401
+
402
+ export interface RefundPremiumRequest {
403
+ userId: string;
404
+ paymentId: string;
405
+ /** optional */
406
+ reason: string;
407
+ }
408
+
409
+ export interface RefundPremiumResponse {
410
+ payment:
411
+ | PremiumPaymentRow
412
+ | undefined;
413
+ /** ISO 8601 after rollback */
414
+ newExpiresAt: string;
415
+ /** true when rollback put expiresAt <= now */
416
+ subscriptionRevoked: boolean;
417
+ }
418
+
419
+ export interface GetMyPremiumPaymentsRequest {
420
+ userId: string;
421
+ page: number;
422
+ limit: number;
423
+ }
424
+
425
+ export interface PremiumPaymentsListResponse {
426
+ items: PremiumPaymentRow[];
427
+ total: number;
428
+ page: number;
429
+ limit: number;
430
+ }
431
+
432
+ /**
433
+ * ---------------------------------------------------------------------------
434
+ * Saved cards (YooKassa payment_method tokens; we never see PAN)
435
+ * ---------------------------------------------------------------------------
436
+ */
437
+ export interface SavedCard {
438
+ id: string;
439
+ /** "MIR" | "VISA" | "MASTERCARD" | "" */
440
+ brand: string;
441
+ /** "0000" etc, display-only */
442
+ last4: string;
443
+ expMonth: number;
444
+ expYear: number;
445
+ isDefault: boolean;
446
+ /** user-set label */
447
+ nickname: string;
448
+ createdAt: string;
449
+ }
450
+
451
+ export interface ListSavedCardsRequest {
452
+ userId: string;
453
+ }
454
+
455
+ export interface ListSavedCardsResponse {
456
+ items: SavedCard[];
457
+ }
458
+
459
+ export interface DeleteSavedCardRequest {
460
+ userId: string;
461
+ id: string;
462
+ }
463
+
464
+ export interface SetDefaultSavedCardRequest {
465
+ userId: string;
466
+ id: string;
467
+ }
468
+
469
+ export interface UpdateSavedCardRequest {
470
+ userId: string;
471
+ id: string;
472
+ /** empty = clear */
473
+ nickname: string;
474
+ }
475
+
476
+ /**
477
+ * ---------------------------------------------------------------------------
478
+ * Payout details (persistent default; per-withdrawal override still allowed)
479
+ * ---------------------------------------------------------------------------
480
+ */
481
+ export interface UpdatePayoutDetailsRequest {
482
+ userId: string;
483
+ /** "card" | "sbp" | "bank" | "" (clear) */
484
+ method: string;
485
+ /** JSON string — payments-service treats opaquely */
486
+ details: string;
487
+ }
488
+
489
+ export interface UpdatePayoutDetailsResponse {
490
+ method: string;
491
+ details: string;
492
+ }
493
+
494
+ export interface GetPayoutDetailsRequest {
495
+ userId: string;
496
+ }
497
+
316
498
  export const PAYMENTS_V1_PACKAGE_NAME = "payments.v1";
317
499
 
318
500
  /**
@@ -352,6 +534,44 @@ export interface PaymentsServiceClient {
352
534
 
353
535
  handlePaymentEvent(request: PaymentEventRequest): Observable<Ok>;
354
536
 
537
+ /** ----- premium ----- */
538
+
539
+ getPremiumPlans(request: GetPremiumPlansRequest): Observable<PremiumPlansResponse>;
540
+
541
+ purchasePremium(request: PurchasePremiumRequest): Observable<PurchasePremiumResponse>;
542
+
543
+ /**
544
+ * 7-day refund window from completedAt. Reverses ledger, calls YooKassa for
545
+ * card purchases, rolls back the subscription's expiresAt by the period.
546
+ */
547
+
548
+ refundPremium(request: RefundPremiumRequest): Observable<RefundPremiumResponse>;
549
+
550
+ getMyPremiumPayments(request: GetMyPremiumPaymentsRequest): Observable<PremiumPaymentsListResponse>;
551
+
552
+ /**
553
+ * Internal — InternalServiceGuard. tasks-service cron triggers due renewals;
554
+ * payments-service iterates ACTIVE subscriptions with autoRenew+savedCard.
555
+ */
556
+
557
+ runPremiumRenewals(request: RunPremiumRenewalsRequest): Observable<RunPremiumRenewalsResponse>;
558
+
559
+ /** ----- saved cards ----- */
560
+
561
+ listSavedCards(request: ListSavedCardsRequest): Observable<ListSavedCardsResponse>;
562
+
563
+ deleteSavedCard(request: DeleteSavedCardRequest): Observable<Ok>;
564
+
565
+ setDefaultSavedCard(request: SetDefaultSavedCardRequest): Observable<SavedCard>;
566
+
567
+ updateSavedCard(request: UpdateSavedCardRequest): Observable<SavedCard>;
568
+
569
+ /** ----- payout details ----- */
570
+
571
+ updatePayoutDetails(request: UpdatePayoutDetailsRequest): Observable<UpdatePayoutDetailsResponse>;
572
+
573
+ getPayoutDetails(request: GetPayoutDetailsRequest): Observable<UpdatePayoutDetailsResponse>;
574
+
355
575
  /** ----- admin ----- */
356
576
 
357
577
  getAdminOverview(request: AdminOverviewRequest): Observable<AdminOverviewResponse>;
@@ -410,6 +630,60 @@ export interface PaymentsServiceController {
410
630
 
411
631
  handlePaymentEvent(request: PaymentEventRequest): Promise<Ok> | Observable<Ok> | Ok;
412
632
 
633
+ /** ----- premium ----- */
634
+
635
+ getPremiumPlans(
636
+ request: GetPremiumPlansRequest,
637
+ ): Promise<PremiumPlansResponse> | Observable<PremiumPlansResponse> | PremiumPlansResponse;
638
+
639
+ purchasePremium(
640
+ request: PurchasePremiumRequest,
641
+ ): Promise<PurchasePremiumResponse> | Observable<PurchasePremiumResponse> | PurchasePremiumResponse;
642
+
643
+ /**
644
+ * 7-day refund window from completedAt. Reverses ledger, calls YooKassa for
645
+ * card purchases, rolls back the subscription's expiresAt by the period.
646
+ */
647
+
648
+ refundPremium(
649
+ request: RefundPremiumRequest,
650
+ ): Promise<RefundPremiumResponse> | Observable<RefundPremiumResponse> | RefundPremiumResponse;
651
+
652
+ getMyPremiumPayments(
653
+ request: GetMyPremiumPaymentsRequest,
654
+ ): Promise<PremiumPaymentsListResponse> | Observable<PremiumPaymentsListResponse> | PremiumPaymentsListResponse;
655
+
656
+ /**
657
+ * Internal — InternalServiceGuard. tasks-service cron triggers due renewals;
658
+ * payments-service iterates ACTIVE subscriptions with autoRenew+savedCard.
659
+ */
660
+
661
+ runPremiumRenewals(
662
+ request: RunPremiumRenewalsRequest,
663
+ ): Promise<RunPremiumRenewalsResponse> | Observable<RunPremiumRenewalsResponse> | RunPremiumRenewalsResponse;
664
+
665
+ /** ----- saved cards ----- */
666
+
667
+ listSavedCards(
668
+ request: ListSavedCardsRequest,
669
+ ): Promise<ListSavedCardsResponse> | Observable<ListSavedCardsResponse> | ListSavedCardsResponse;
670
+
671
+ deleteSavedCard(request: DeleteSavedCardRequest): Promise<Ok> | Observable<Ok> | Ok;
672
+
673
+ setDefaultSavedCard(request: SetDefaultSavedCardRequest): Promise<SavedCard> | Observable<SavedCard> | SavedCard;
674
+
675
+ updateSavedCard(request: UpdateSavedCardRequest): Promise<SavedCard> | Observable<SavedCard> | SavedCard;
676
+
677
+ /** ----- payout details ----- */
678
+
679
+ updatePayoutDetails(
680
+ request: UpdatePayoutDetailsRequest,
681
+ ): Promise<UpdatePayoutDetailsResponse> | Observable<UpdatePayoutDetailsResponse> | UpdatePayoutDetailsResponse;
682
+
683
+ getPayoutDetails(
684
+ request: GetPayoutDetailsRequest,
685
+ ): Promise<UpdatePayoutDetailsResponse> | Observable<UpdatePayoutDetailsResponse> | UpdatePayoutDetailsResponse;
686
+
413
687
  /** ----- admin ----- */
414
688
 
415
689
  getAdminOverview(
@@ -445,6 +719,17 @@ export function PaymentsServiceControllerMethods() {
445
719
  "listWithdrawals",
446
720
  "processWithdrawal",
447
721
  "handlePaymentEvent",
722
+ "getPremiumPlans",
723
+ "purchasePremium",
724
+ "refundPremium",
725
+ "getMyPremiumPayments",
726
+ "runPremiumRenewals",
727
+ "listSavedCards",
728
+ "deleteSavedCard",
729
+ "setDefaultSavedCard",
730
+ "updateSavedCard",
731
+ "updatePayoutDetails",
732
+ "getPayoutDetails",
448
733
  "getAdminOverview",
449
734
  "adminListTransactions",
450
735
  "getUserFinance",