@aepstore-dev/contracts 1.57.0 → 1.58.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
@@ -306,6 +306,8 @@ export interface PremiumStateResponse {
306
306
  expiresAt: string;
307
307
  autoRenew: boolean;
308
308
  hasSavedPaymentMethod: boolean;
309
+ /** null when not active */
310
+ plan: PremiumPlanInfo | undefined;
309
311
  }
310
312
  export interface SetPremiumAutoRenewRequest {
311
313
  userId: string;
@@ -322,6 +324,8 @@ export interface ActivatePremiumRequest {
322
324
  paymentMethodId: string;
323
325
  /** false = first purchase; true = cron-driven renewal */
324
326
  isRenewal: boolean;
327
+ /** set by the purchase flow; renewals keep true */
328
+ autoRenew: boolean;
325
329
  }
326
330
  export interface IsPremiumActiveRequest {
327
331
  userId: string;
@@ -520,16 +524,6 @@ export interface PremiumPlanInfo {
520
524
  discountPercent: string;
521
525
  currency: string;
522
526
  }
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
527
  export interface AccountSettingsResponse {
534
528
  /** Identity */
535
529
  id: string;
@@ -559,7 +553,7 @@ export interface AccountSettingsResponse {
559
553
  /** Payout defaults */
560
554
  payoutMethod: string;
561
555
  payoutDetails: string;
562
- premium: PremiumInfo | undefined;
556
+ premiumIsActive: boolean;
563
557
  /** Soft-delete state */
564
558
  deletedAt: string;
565
559
  scheduledForHardDelete: string;
package/gen/users.ts CHANGED
@@ -353,6 +353,8 @@ export interface PremiumStateResponse {
353
353
  expiresAt: string;
354
354
  autoRenew: boolean;
355
355
  hasSavedPaymentMethod: boolean;
356
+ /** null when not active */
357
+ plan: PremiumPlanInfo | undefined;
356
358
  }
357
359
 
358
360
  export interface SetPremiumAutoRenewRequest {
@@ -371,6 +373,8 @@ export interface ActivatePremiumRequest {
371
373
  paymentMethodId: string;
372
374
  /** false = first purchase; true = cron-driven renewal */
373
375
  isRenewal: boolean;
376
+ /** set by the purchase flow; renewals keep true */
377
+ autoRenew: boolean;
374
378
  }
375
379
 
376
380
  export interface IsPremiumActiveRequest {
@@ -606,17 +610,6 @@ export interface PremiumPlanInfo {
606
610
  currency: string;
607
611
  }
608
612
 
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
613
  export interface AccountSettingsResponse {
621
614
  /** Identity */
622
615
  id: string;
@@ -646,9 +639,7 @@ export interface AccountSettingsResponse {
646
639
  /** Payout defaults */
647
640
  payoutMethod: string;
648
641
  payoutDetails: string;
649
- premium:
650
- | PremiumInfo
651
- | undefined;
642
+ premiumIsActive: boolean;
652
643
  /** Soft-delete state */
653
644
  deletedAt: string;
654
645
  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.58.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,16 @@ 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
+ bool has_saved_payment_method = 7;
408
+ PremiumPlanInfo plan = 8; // null when not active
409
+ }
409
410
 
410
411
  message SetPremiumAutoRenewRequest {
411
412
  string user_id = 1;
@@ -414,12 +415,13 @@ message SetPremiumAutoRenewRequest {
414
415
 
415
416
  // Internal — payments-service hands us the period that was just paid for, plus
416
417
  // 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
- }
418
+ message ActivatePremiumRequest {
419
+ string user_id = 1;
420
+ PremiumPeriod period = 2;
421
+ string payment_method_id = 3; // empty for BALANCE / one-shot
422
+ bool is_renewal = 4; // false = first purchase; true = cron-driven renewal
423
+ bool auto_renew = 5; // set by the purchase flow; renewals keep true
424
+ }
423
425
 
424
426
  message IsPremiumActiveRequest {
425
427
  string user_id = 1;
@@ -655,15 +657,7 @@ message PremiumPlanInfo {
655
657
  string currency = 6;
656
658
  }
657
659
 
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 {
660
+ message AccountSettingsResponse {
667
661
  // Identity
668
662
  string id = 1;
669
663
  string username = 2;
@@ -697,10 +691,12 @@ message AccountSettingsResponse {
697
691
  string payout_method = 22;
698
692
  string payout_details = 23;
699
693
 
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;
694
+ // Premium snapshot — flat flag only. Rich subscription state lives at
695
+ // /premium/me.
696
+ reserved 24, 25, 26, 27;
697
+ reserved "premium_status", "premium_expires_at", "premium_auto_renew";
698
+ reserved 36;
699
+ bool premium_is_active = 37;
704
700
 
705
701
  // Soft-delete state
706
702
  string deleted_at = 28;