@barumetric/contracts 1.3.10 → 1.3.12

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/ts/payment.ts CHANGED
@@ -7,9 +7,19 @@
7
7
  /* eslint-disable */
8
8
  import { GrpcMethod, GrpcStreamMethod } from "@nestjs/microservices";
9
9
  import { Observable } from "rxjs";
10
+ import { Timestamp } from "./google/protobuf/timestamp";
10
11
 
11
12
  export const protobufPackage = "payment.v1";
12
13
 
14
+ export enum PaymentStatus {
15
+ UNSPECIFIED = 0,
16
+ PENDING = 1,
17
+ SUCCESS = 2,
18
+ FAILED = 3,
19
+ REFUNDED = 4,
20
+ UNRECOGNIZED = -1,
21
+ }
22
+
13
23
  /** Запрос на пополнение баланса */
14
24
  export interface TopUpBalanceRequest {
15
25
  userId: string;
@@ -85,6 +95,43 @@ export interface PaymentMethodItem {
85
95
  last4: string;
86
96
  }
87
97
 
98
+ /** История платежей пользователя */
99
+ export interface GetUserPaymentsRequest {
100
+ userId: string;
101
+ /** фильтр по статусу (опционально) */
102
+ status?:
103
+ | PaymentStatus
104
+ | undefined;
105
+ /** количество записей (по умолчанию 20, максимум 100) */
106
+ limit?:
107
+ | number
108
+ | undefined;
109
+ /** смещение для пагинации (по умолчанию 0) */
110
+ offset?:
111
+ | number
112
+ | undefined;
113
+ /** курсор для курсорной пагинации (альтернатива offset) */
114
+ cursor?: string | undefined;
115
+ }
116
+
117
+ export interface GetUserPaymentsResponse {
118
+ payments: PaymentItem[];
119
+ /** общее количество платежей */
120
+ total: number;
121
+ /** есть ли еще записи */
122
+ hasMore: boolean;
123
+ /** курсор для следующей страницы */
124
+ nextCursor?: string | undefined;
125
+ }
126
+
127
+ export interface PaymentItem {
128
+ id: string;
129
+ /** сумма в минимальных единицах (копейки) */
130
+ amount: number;
131
+ status: PaymentStatus;
132
+ createdAt: Timestamp | undefined;
133
+ }
134
+
88
135
  export const PAYMENT_V1_PACKAGE_NAME = "payment.v1";
89
136
 
90
137
  export interface PaymentServiceClient {
@@ -99,6 +146,8 @@ export interface PaymentServiceClient {
99
146
  verifyPaymentMethod(request: VerifyPaymentMethodRequest): Observable<VerifyPaymentMethodResponse>;
100
147
 
101
148
  deletePaymentMethod(request: DeletePaymentMethodRequest): Observable<DeletePaymentMethodResponse>;
149
+
150
+ getUserPayments(request: GetUserPaymentsRequest): Observable<GetUserPaymentsResponse>;
102
151
  }
103
152
 
104
153
  export interface PaymentServiceController {
@@ -125,6 +174,10 @@ export interface PaymentServiceController {
125
174
  deletePaymentMethod(
126
175
  request: DeletePaymentMethodRequest,
127
176
  ): Promise<DeletePaymentMethodResponse> | Observable<DeletePaymentMethodResponse> | DeletePaymentMethodResponse;
177
+
178
+ getUserPayments(
179
+ request: GetUserPaymentsRequest,
180
+ ): Promise<GetUserPaymentsResponse> | Observable<GetUserPaymentsResponse> | GetUserPaymentsResponse;
128
181
  }
129
182
 
130
183
  export function PaymentServiceControllerMethods() {
@@ -136,6 +189,7 @@ export function PaymentServiceControllerMethods() {
136
189
  "createPaymentMethod",
137
190
  "verifyPaymentMethod",
138
191
  "deletePaymentMethod",
192
+ "getUserPayments",
139
193
  ];
140
194
  for (const method of grpcMethods) {
141
195
  const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@barumetric/contracts",
3
- "version": "1.3.10",
3
+ "version": "1.3.12",
4
4
  "description": "Protobuf definitions and generated TypeScript types",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",
@@ -24,6 +24,5 @@
24
24
  "devDependencies": {
25
25
  "@types/node": "^25.0.3",
26
26
  "typescript": "^5.9.3"
27
-
28
27
  }
29
28
  }
@@ -2,6 +2,8 @@ syntax = "proto3";
2
2
 
3
3
  package payment.v1;
4
4
 
5
+ import "google/protobuf/timestamp.proto";
6
+
5
7
  service PaymentService {
6
8
  rpc TopUpBalance (TopUpBalanceRequest) returns (TopUpBalanceResponse);
7
9
  rpc ProcessPaymentEvent (ProcessPaymentEventRequest) returns (ProcessPaymentEventResponse);
@@ -10,6 +12,8 @@ service PaymentService {
10
12
  rpc CreatePaymentMethod (CreatePaymentMethodRequest) returns (CreatePaymentMethodResponse);
11
13
  rpc VerifyPaymentMethod (VerifyPaymentMethodRequest) returns (VerifyPaymentMethodResponse);
12
14
  rpc DeletePaymentMethod (DeletePaymentMethodRequest) returns (DeletePaymentMethodResponse);
15
+
16
+ rpc GetUserPayments (GetUserPaymentsRequest) returns (GetUserPaymentsResponse);
13
17
  }
14
18
 
15
19
  // Запрос на пополнение баланса
@@ -84,3 +88,34 @@ message PaymentMethodItem {
84
88
  string first6 = 4;
85
89
  string last4 = 5;
86
90
  }
91
+
92
+ // История платежей пользователя
93
+ message GetUserPaymentsRequest {
94
+ string user_id = 1;
95
+ optional PaymentStatus status = 2; // фильтр по статусу (опционально)
96
+ optional int32 limit = 3; // количество записей (по умолчанию 20, максимум 100)
97
+ optional int32 offset = 4; // смещение для пагинации (по умолчанию 0)
98
+ optional string cursor = 5; // курсор для курсорной пагинации (альтернатива offset)
99
+ }
100
+
101
+ message GetUserPaymentsResponse {
102
+ repeated PaymentItem payments = 1;
103
+ int32 total = 2; // общее количество платежей
104
+ bool has_more = 3; // есть ли еще записи
105
+ optional string next_cursor = 4; // курсор для следующей страницы
106
+ }
107
+
108
+ message PaymentItem {
109
+ string id = 1;
110
+ int64 amount = 2; // сумма в минимальных единицах (копейки)
111
+ PaymentStatus status = 3;
112
+ google.protobuf.Timestamp created_at = 4;
113
+ }
114
+
115
+ enum PaymentStatus {
116
+ UNSPECIFIED = 0;
117
+ PENDING = 1;
118
+ SUCCESS = 2;
119
+ FAILED = 3;
120
+ REFUNDED = 4;
121
+ }