@aepstore-dev/contracts 1.57.0 → 1.59.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/payments.d.ts CHANGED
@@ -406,15 +406,19 @@ export interface PurchasePremiumRequest {
406
406
  userId: string;
407
407
  /** MONTH_1 | MONTH_3 | MONTH_6 | MONTH_12 */
408
408
  period: string;
409
- /** BALANCE | YOOKASSA */
409
+ /** BALANCE | YOOKASSA | SAVED_CARD (empty = smart default) */
410
410
  paymentMethod: string;
411
411
  /** YooKassa only */
412
412
  returnUrl: string;
413
413
  /**
414
414
  * Save the YooKassa payment_method for future auto-renewals. Ignored for
415
- * BALANCE. Default true the UI surfaces a checkbox.
415
+ * BALANCE. Kept for backwards compatibility; auto_renew=true implies save.
416
416
  */
417
417
  savePaymentMethod: boolean;
418
+ /** default false; requires off-session-capable method */
419
+ autoRenew: boolean;
420
+ /** optional for SAVED_CARD; empty = default card */
421
+ savedCardId: string;
418
422
  }
419
423
  export interface PurchasePremiumResponse {
420
424
  /** PremiumPayment.id */
@@ -433,6 +437,20 @@ export interface RunPremiumRenewalsResponse {
433
437
  succeeded: number;
434
438
  failed: number;
435
439
  }
440
+ export interface SetPremiumPaymentMethodRequest {
441
+ userId: string;
442
+ /** BALANCE | YOOKASSA | SAVED_CARD */
443
+ method: string;
444
+ /** optional for SAVED_CARD; empty = default card */
445
+ savedCardId: string;
446
+ }
447
+ export interface PremiumPaymentMethodResponse {
448
+ /** BALANCE | YOOKASSA | SAVED_CARD */
449
+ method: string;
450
+ /** empty unless SAVED_CARD */
451
+ savedCardId: string;
452
+ autoRenew: boolean;
453
+ }
436
454
  export interface PremiumPaymentRow {
437
455
  id: string;
438
456
  userId: string;
@@ -561,6 +579,7 @@ export interface PaymentsServiceClient {
561
579
  /** ----- premium ----- */
562
580
  getPremiumPlans(request: GetPremiumPlansRequest): Observable<PremiumPlansResponse>;
563
581
  purchasePremium(request: PurchasePremiumRequest): Observable<PurchasePremiumResponse>;
582
+ setPremiumPaymentMethod(request: SetPremiumPaymentMethodRequest): Observable<PremiumPaymentMethodResponse>;
564
583
  /**
565
584
  * 7-day refund window from completedAt. Reverses ledger, calls YooKassa for
566
585
  * card purchases, rolls back the subscription's expiresAt by the period.
@@ -623,6 +642,7 @@ export interface PaymentsServiceController {
623
642
  /** ----- premium ----- */
624
643
  getPremiumPlans(request: GetPremiumPlansRequest): Promise<PremiumPlansResponse> | Observable<PremiumPlansResponse> | PremiumPlansResponse;
625
644
  purchasePremium(request: PurchasePremiumRequest): Promise<PurchasePremiumResponse> | Observable<PurchasePremiumResponse> | PurchasePremiumResponse;
645
+ setPremiumPaymentMethod(request: SetPremiumPaymentMethodRequest): Promise<PremiumPaymentMethodResponse> | Observable<PremiumPaymentMethodResponse> | PremiumPaymentMethodResponse;
626
646
  /**
627
647
  * 7-day refund window from completedAt. Reverses ledger, calls YooKassa for
628
648
  * card purchases, rolls back the subscription's expiresAt by the period.
package/gen/payments.js CHANGED
@@ -28,6 +28,7 @@ function PaymentsServiceControllerMethods() {
28
28
  "handlePaymentEvent",
29
29
  "getPremiumPlans",
30
30
  "purchasePremium",
31
+ "setPremiumPaymentMethod",
31
32
  "refundPremium",
32
33
  "getMyPremiumPayments",
33
34
  "runPremiumRenewals",
package/gen/payments.ts CHANGED
@@ -458,15 +458,19 @@ export interface PurchasePremiumRequest {
458
458
  userId: string;
459
459
  /** MONTH_1 | MONTH_3 | MONTH_6 | MONTH_12 */
460
460
  period: string;
461
- /** BALANCE | YOOKASSA */
461
+ /** BALANCE | YOOKASSA | SAVED_CARD (empty = smart default) */
462
462
  paymentMethod: string;
463
463
  /** YooKassa only */
464
464
  returnUrl: string;
465
465
  /**
466
466
  * Save the YooKassa payment_method for future auto-renewals. Ignored for
467
- * BALANCE. Default true the UI surfaces a checkbox.
467
+ * BALANCE. Kept for backwards compatibility; auto_renew=true implies save.
468
468
  */
469
469
  savePaymentMethod: boolean;
470
+ /** default false; requires off-session-capable method */
471
+ autoRenew: boolean;
472
+ /** optional for SAVED_CARD; empty = default card */
473
+ savedCardId: string;
470
474
  }
471
475
 
472
476
  export interface PurchasePremiumResponse {
@@ -489,6 +493,22 @@ export interface RunPremiumRenewalsResponse {
489
493
  failed: number;
490
494
  }
491
495
 
496
+ export interface SetPremiumPaymentMethodRequest {
497
+ userId: string;
498
+ /** BALANCE | YOOKASSA | SAVED_CARD */
499
+ method: string;
500
+ /** optional for SAVED_CARD; empty = default card */
501
+ savedCardId: string;
502
+ }
503
+
504
+ export interface PremiumPaymentMethodResponse {
505
+ /** BALANCE | YOOKASSA | SAVED_CARD */
506
+ method: string;
507
+ /** empty unless SAVED_CARD */
508
+ savedCardId: string;
509
+ autoRenew: boolean;
510
+ }
511
+
492
512
  export interface PremiumPaymentRow {
493
513
  id: string;
494
514
  userId: string;
@@ -654,6 +674,8 @@ export interface PaymentsServiceClient {
654
674
 
655
675
  purchasePremium(request: PurchasePremiumRequest): Observable<PurchasePremiumResponse>;
656
676
 
677
+ setPremiumPaymentMethod(request: SetPremiumPaymentMethodRequest): Observable<PremiumPaymentMethodResponse>;
678
+
657
679
  /**
658
680
  * 7-day refund window from completedAt. Reverses ledger, calls YooKassa for
659
681
  * card purchases, rolls back the subscription's expiresAt by the period.
@@ -773,6 +795,10 @@ export interface PaymentsServiceController {
773
795
  request: PurchasePremiumRequest,
774
796
  ): Promise<PurchasePremiumResponse> | Observable<PurchasePremiumResponse> | PurchasePremiumResponse;
775
797
 
798
+ setPremiumPaymentMethod(
799
+ request: SetPremiumPaymentMethodRequest,
800
+ ): Promise<PremiumPaymentMethodResponse> | Observable<PremiumPaymentMethodResponse> | PremiumPaymentMethodResponse;
801
+
776
802
  /**
777
803
  * 7-day refund window from completedAt. Reverses ledger, calls YooKassa for
778
804
  * card purchases, rolls back the subscription's expiresAt by the period.
@@ -872,6 +898,7 @@ export function PaymentsServiceControllerMethods() {
872
898
  "handlePaymentEvent",
873
899
  "getPremiumPlans",
874
900
  "purchasePremium",
901
+ "setPremiumPaymentMethod",
875
902
  "refundPremium",
876
903
  "getMyPremiumPayments",
877
904
  "runPremiumRenewals",
package/gen/users.d.ts CHANGED
@@ -305,7 +305,26 @@ export interface PremiumStateResponse {
305
305
  /** ISO 8601 */
306
306
  expiresAt: string;
307
307
  autoRenew: boolean;
308
- hasSavedPaymentMethod: boolean;
308
+ /** null when not active */
309
+ plan: PremiumPlanInfo | undefined;
310
+ /** null when no premium payment method preference */
311
+ savedPaymentMethod: PremiumSavedPaymentMethod | undefined;
312
+ }
313
+ export interface PremiumSavedPaymentMethod {
314
+ /** BALANCE | YOOKASSA | SAVED_CARD */
315
+ method: string;
316
+ /** null unless method=SAVED_CARD */
317
+ card: PremiumSavedPaymentCard | undefined;
318
+ }
319
+ export interface PremiumSavedPaymentCard {
320
+ id: string;
321
+ brand: string;
322
+ last4: string;
323
+ expMonth: number;
324
+ expYear: number;
325
+ isDefault: boolean;
326
+ nickname: string;
327
+ createdAt: string;
309
328
  }
310
329
  export interface SetPremiumAutoRenewRequest {
311
330
  userId: string;
@@ -322,6 +341,8 @@ export interface ActivatePremiumRequest {
322
341
  paymentMethodId: string;
323
342
  /** false = first purchase; true = cron-driven renewal */
324
343
  isRenewal: boolean;
344
+ /** set by the purchase flow; renewals keep true */
345
+ autoRenew: boolean;
325
346
  }
326
347
  export interface IsPremiumActiveRequest {
327
348
  userId: string;
@@ -520,16 +541,6 @@ export interface PremiumPlanInfo {
520
541
  discountPercent: string;
521
542
  currency: string;
522
543
  }
523
- export interface PremiumInfo {
524
- /** status==ACTIVE AND not past expires_at */
525
- isActive: boolean;
526
- /** ACTIVE | EXPIRED | CANCELED | '' (never had) */
527
- status: string;
528
- expiresAt: string;
529
- autoRenew: boolean;
530
- /** null when not active */
531
- plan: PremiumPlanInfo | undefined;
532
- }
533
544
  export interface AccountSettingsResponse {
534
545
  /** Identity */
535
546
  id: string;
@@ -559,7 +570,7 @@ export interface AccountSettingsResponse {
559
570
  /** Payout defaults */
560
571
  payoutMethod: string;
561
572
  payoutDetails: string;
562
- premium: PremiumInfo | undefined;
573
+ premiumIsActive: boolean;
563
574
  /** Soft-delete state */
564
575
  deletedAt: string;
565
576
  scheduledForHardDelete: string;
package/gen/users.ts CHANGED
@@ -352,7 +352,30 @@ export interface PremiumStateResponse {
352
352
  /** ISO 8601 */
353
353
  expiresAt: string;
354
354
  autoRenew: boolean;
355
- hasSavedPaymentMethod: boolean;
355
+ /** null when not active */
356
+ plan:
357
+ | PremiumPlanInfo
358
+ | undefined;
359
+ /** null when no premium payment method preference */
360
+ savedPaymentMethod: PremiumSavedPaymentMethod | undefined;
361
+ }
362
+
363
+ export interface PremiumSavedPaymentMethod {
364
+ /** BALANCE | YOOKASSA | SAVED_CARD */
365
+ method: string;
366
+ /** null unless method=SAVED_CARD */
367
+ card: PremiumSavedPaymentCard | undefined;
368
+ }
369
+
370
+ export interface PremiumSavedPaymentCard {
371
+ id: string;
372
+ brand: string;
373
+ last4: string;
374
+ expMonth: number;
375
+ expYear: number;
376
+ isDefault: boolean;
377
+ nickname: string;
378
+ createdAt: string;
356
379
  }
357
380
 
358
381
  export interface SetPremiumAutoRenewRequest {
@@ -371,6 +394,8 @@ export interface ActivatePremiumRequest {
371
394
  paymentMethodId: string;
372
395
  /** false = first purchase; true = cron-driven renewal */
373
396
  isRenewal: boolean;
397
+ /** set by the purchase flow; renewals keep true */
398
+ autoRenew: boolean;
374
399
  }
375
400
 
376
401
  export interface IsPremiumActiveRequest {
@@ -606,17 +631,6 @@ export interface PremiumPlanInfo {
606
631
  currency: string;
607
632
  }
608
633
 
609
- export interface PremiumInfo {
610
- /** status==ACTIVE AND not past expires_at */
611
- isActive: boolean;
612
- /** ACTIVE | EXPIRED | CANCELED | '' (never had) */
613
- status: string;
614
- expiresAt: string;
615
- autoRenew: boolean;
616
- /** null when not active */
617
- plan: PremiumPlanInfo | undefined;
618
- }
619
-
620
634
  export interface AccountSettingsResponse {
621
635
  /** Identity */
622
636
  id: string;
@@ -646,9 +660,7 @@ export interface AccountSettingsResponse {
646
660
  /** Payout defaults */
647
661
  payoutMethod: string;
648
662
  payoutDetails: string;
649
- premium:
650
- | PremiumInfo
651
- | undefined;
663
+ premiumIsActive: boolean;
652
664
  /** Soft-delete state */
653
665
  deletedAt: string;
654
666
  scheduledForHardDelete: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aepstore-dev/contracts",
3
- "version": "1.57.0",
3
+ "version": "1.59.0",
4
4
  "description": "Protobuf definitions for aepstore microservices",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",
@@ -26,12 +26,13 @@ service PaymentsService {
26
26
  // ----- provider webhook (gateway forwards a verified event) -----
27
27
  rpc HandlePaymentEvent(PaymentEventRequest) returns (Ok);
28
28
 
29
- // ----- premium -----
30
- rpc GetPremiumPlans(GetPremiumPlansRequest) returns (PremiumPlansResponse);
31
- rpc PurchasePremium(PurchasePremiumRequest) returns (PurchasePremiumResponse);
32
- // 7-day refund window from completedAt. Reverses ledger, calls YooKassa for
33
- // card purchases, rolls back the subscription's expiresAt by the period.
34
- rpc RefundPremium(RefundPremiumRequest) returns (RefundPremiumResponse);
29
+ // ----- premium -----
30
+ rpc GetPremiumPlans(GetPremiumPlansRequest) returns (PremiumPlansResponse);
31
+ rpc PurchasePremium(PurchasePremiumRequest) returns (PurchasePremiumResponse);
32
+ rpc SetPremiumPaymentMethod(SetPremiumPaymentMethodRequest) returns (PremiumPaymentMethodResponse);
33
+ // 7-day refund window from completedAt. Reverses ledger, calls YooKassa for
34
+ // card purchases, rolls back the subscription's expiresAt by the period.
35
+ rpc RefundPremium(RefundPremiumRequest) returns (RefundPremiumResponse);
35
36
  rpc GetMyPremiumPayments(GetMyPremiumPaymentsRequest) returns (PremiumPaymentsListResponse);
36
37
  // Internal — InternalServiceGuard. tasks-service cron triggers due renewals;
37
38
  // payments-service iterates ACTIVE subscriptions with autoRenew+savedCard.
@@ -333,15 +334,17 @@ message PremiumPlansResponse {
333
334
  string base_monthly_price = 2;
334
335
  }
335
336
 
336
- message PurchasePremiumRequest {
337
- string user_id = 1;
338
- string period = 2; // MONTH_1 | MONTH_3 | MONTH_6 | MONTH_12
339
- string payment_method = 3; // BALANCE | YOOKASSA
340
- string return_url = 4; // YooKassa only
341
- // Save the YooKassa payment_method for future auto-renewals. Ignored for
342
- // BALANCE. Default true the UI surfaces a checkbox.
343
- bool save_payment_method = 5;
344
- }
337
+ message PurchasePremiumRequest {
338
+ string user_id = 1;
339
+ string period = 2; // MONTH_1 | MONTH_3 | MONTH_6 | MONTH_12
340
+ string payment_method = 3; // BALANCE | YOOKASSA | SAVED_CARD (empty = smart default)
341
+ string return_url = 4; // YooKassa only
342
+ // Save the YooKassa payment_method for future auto-renewals. Ignored for
343
+ // BALANCE. Kept for backwards compatibility; auto_renew=true implies save.
344
+ bool save_payment_method = 5;
345
+ bool auto_renew = 6; // default false; requires off-session-capable method
346
+ string saved_card_id = 7; // optional for SAVED_CARD; empty = default card
347
+ }
345
348
 
346
349
  message PurchasePremiumResponse {
347
350
  string payment_id = 1; // PremiumPayment.id
@@ -353,13 +356,25 @@ message RunPremiumRenewalsRequest {
353
356
  int32 max_batch = 1; // safety cap; default 100
354
357
  }
355
358
 
356
- message RunPremiumRenewalsResponse {
357
- int32 attempted = 1;
358
- int32 succeeded = 2;
359
- int32 failed = 3;
360
- }
361
-
362
- message PremiumPaymentRow {
359
+ message RunPremiumRenewalsResponse {
360
+ int32 attempted = 1;
361
+ int32 succeeded = 2;
362
+ int32 failed = 3;
363
+ }
364
+
365
+ message SetPremiumPaymentMethodRequest {
366
+ string user_id = 1;
367
+ string method = 2; // BALANCE | YOOKASSA | SAVED_CARD
368
+ string saved_card_id = 3; // optional for SAVED_CARD; empty = default card
369
+ }
370
+
371
+ message PremiumPaymentMethodResponse {
372
+ string method = 1; // BALANCE | YOOKASSA | SAVED_CARD
373
+ string saved_card_id = 2; // empty unless SAVED_CARD
374
+ bool auto_renew = 3;
375
+ }
376
+
377
+ message PremiumPaymentRow {
363
378
  string id = 1;
364
379
  string user_id = 2;
365
380
  string amount = 3;
package/proto/users.proto CHANGED
@@ -397,15 +397,35 @@ message GetMyPremiumRequest {
397
397
  string user_id = 1;
398
398
  }
399
399
 
400
- message PremiumStateResponse {
401
- bool is_active = 1;
402
- string status = 2; // ACTIVE | EXPIRED | CANCELED | empty (never purchased)
403
- PremiumPeriod current_period = 3;
404
- string started_at = 4; // ISO 8601, empty when never purchased
405
- string expires_at = 5; // ISO 8601
406
- bool auto_renew = 6;
407
- bool has_saved_payment_method = 7;
408
- }
400
+ message PremiumStateResponse {
401
+ bool is_active = 1;
402
+ string status = 2; // ACTIVE | EXPIRED | CANCELED | empty (never purchased)
403
+ PremiumPeriod current_period = 3;
404
+ string started_at = 4; // ISO 8601, empty when never purchased
405
+ string expires_at = 5; // ISO 8601
406
+ bool auto_renew = 6;
407
+ PremiumPlanInfo plan = 8; // null when not active
408
+ PremiumSavedPaymentMethod saved_payment_method = 9; // null when no premium payment method preference
409
+
410
+ reserved 7;
411
+ reserved "has_saved_payment_method";
412
+ }
413
+
414
+ message PremiumSavedPaymentMethod {
415
+ string method = 1; // BALANCE | YOOKASSA | SAVED_CARD
416
+ PremiumSavedPaymentCard card = 2; // null unless method=SAVED_CARD
417
+ }
418
+
419
+ message PremiumSavedPaymentCard {
420
+ string id = 1;
421
+ string brand = 2;
422
+ string last4 = 3;
423
+ int32 exp_month = 4;
424
+ int32 exp_year = 5;
425
+ bool is_default = 6;
426
+ string nickname = 7;
427
+ string created_at = 8;
428
+ }
409
429
 
410
430
  message SetPremiumAutoRenewRequest {
411
431
  string user_id = 1;
@@ -414,12 +434,13 @@ message SetPremiumAutoRenewRequest {
414
434
 
415
435
  // Internal — payments-service hands us the period that was just paid for, plus
416
436
  // the YooKassa payment_method id (empty for balance/non-recurring purchases).
417
- message ActivatePremiumRequest {
418
- string user_id = 1;
419
- PremiumPeriod period = 2;
420
- string payment_method_id = 3; // empty for BALANCE / one-shot
421
- bool is_renewal = 4; // false = first purchase; true = cron-driven renewal
422
- }
437
+ message ActivatePremiumRequest {
438
+ string user_id = 1;
439
+ PremiumPeriod period = 2;
440
+ string payment_method_id = 3; // empty for BALANCE / one-shot
441
+ bool is_renewal = 4; // false = first purchase; true = cron-driven renewal
442
+ bool auto_renew = 5; // set by the purchase flow; renewals keep true
443
+ }
423
444
 
424
445
  message IsPremiumActiveRequest {
425
446
  string user_id = 1;
@@ -655,15 +676,7 @@ message PremiumPlanInfo {
655
676
  string currency = 6;
656
677
  }
657
678
 
658
- message PremiumInfo {
659
- bool is_active = 1; // status==ACTIVE AND not past expires_at
660
- string status = 2; // ACTIVE | EXPIRED | CANCELED | '' (never had)
661
- string expires_at = 3;
662
- bool auto_renew = 4;
663
- PremiumPlanInfo plan = 5; // null when not active
664
- }
665
-
666
- message AccountSettingsResponse {
679
+ message AccountSettingsResponse {
667
680
  // Identity
668
681
  string id = 1;
669
682
  string username = 2;
@@ -697,10 +710,12 @@ message AccountSettingsResponse {
697
710
  string payout_method = 22;
698
711
  string payout_details = 23;
699
712
 
700
- // Premium snapshot — grouped under one object (was flat fields 24-27).
701
- reserved 24, 25, 26, 27;
702
- reserved "premium_is_active", "premium_status", "premium_expires_at", "premium_auto_renew";
703
- PremiumInfo premium = 36;
713
+ // Premium snapshot — flat flag only. Rich subscription state lives at
714
+ // /premium/me.
715
+ reserved 24, 25, 26, 27;
716
+ reserved "premium_status", "premium_expires_at", "premium_auto_renew";
717
+ reserved 36;
718
+ bool premium_is_active = 37;
704
719
 
705
720
  // Soft-delete state
706
721
  string deleted_at = 28;