@barumetric/contracts 1.3.9 → 1.3.11
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
|
@@ -10,6 +10,15 @@ import { Observable } from "rxjs";
|
|
|
10
10
|
|
|
11
11
|
export const protobufPackage = "payment.v1";
|
|
12
12
|
|
|
13
|
+
export enum PaymentStatus {
|
|
14
|
+
PAYMENT_STATUS_UNSPECIFIED = 0,
|
|
15
|
+
PAYMENT_STATUS_PENDING = 1,
|
|
16
|
+
PAYMENT_STATUS_SUCCESS = 2,
|
|
17
|
+
PAYMENT_STATUS_FAILED = 3,
|
|
18
|
+
PAYMENT_STATUS_REFUNDED = 4,
|
|
19
|
+
UNRECOGNIZED = -1,
|
|
20
|
+
}
|
|
21
|
+
|
|
13
22
|
/** Запрос на пополнение баланса */
|
|
14
23
|
export interface TopUpBalanceRequest {
|
|
15
24
|
userId: string;
|
|
@@ -85,6 +94,50 @@ export interface PaymentMethodItem {
|
|
|
85
94
|
last4: string;
|
|
86
95
|
}
|
|
87
96
|
|
|
97
|
+
/** История платежей пользователя */
|
|
98
|
+
export interface GetUserPaymentsRequest {
|
|
99
|
+
userId: string;
|
|
100
|
+
/** фильтр по статусу (опционально) */
|
|
101
|
+
status?:
|
|
102
|
+
| PaymentStatus
|
|
103
|
+
| undefined;
|
|
104
|
+
/** количество записей (по умолчанию 20, максимум 100) */
|
|
105
|
+
limit?:
|
|
106
|
+
| number
|
|
107
|
+
| undefined;
|
|
108
|
+
/** смещение для пагинации (по умолчанию 0) */
|
|
109
|
+
offset?:
|
|
110
|
+
| number
|
|
111
|
+
| undefined;
|
|
112
|
+
/** курсор для курсорной пагинации (альтернатива offset) */
|
|
113
|
+
cursor?: string | undefined;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
export interface GetUserPaymentsResponse {
|
|
117
|
+
payments: PaymentItem[];
|
|
118
|
+
/** общее количество платежей */
|
|
119
|
+
total: number;
|
|
120
|
+
/** есть ли еще записи */
|
|
121
|
+
hasMore: boolean;
|
|
122
|
+
/** курсор для следующей страницы */
|
|
123
|
+
nextCursor?: string | undefined;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
export interface PaymentItem {
|
|
127
|
+
id: string;
|
|
128
|
+
/** сумма в минимальных единицах (копейки) */
|
|
129
|
+
amount: number;
|
|
130
|
+
status: PaymentStatus;
|
|
131
|
+
/** ID платежа в провайдере (YooKassa) */
|
|
132
|
+
providerId?:
|
|
133
|
+
| string
|
|
134
|
+
| undefined;
|
|
135
|
+
/** ISO 8601 timestamp */
|
|
136
|
+
createdAt: string;
|
|
137
|
+
/** ISO 8601 timestamp */
|
|
138
|
+
updatedAt: string;
|
|
139
|
+
}
|
|
140
|
+
|
|
88
141
|
export const PAYMENT_V1_PACKAGE_NAME = "payment.v1";
|
|
89
142
|
|
|
90
143
|
export interface PaymentServiceClient {
|
|
@@ -99,6 +152,8 @@ export interface PaymentServiceClient {
|
|
|
99
152
|
verifyPaymentMethod(request: VerifyPaymentMethodRequest): Observable<VerifyPaymentMethodResponse>;
|
|
100
153
|
|
|
101
154
|
deletePaymentMethod(request: DeletePaymentMethodRequest): Observable<DeletePaymentMethodResponse>;
|
|
155
|
+
|
|
156
|
+
getUserPayments(request: GetUserPaymentsRequest): Observable<GetUserPaymentsResponse>;
|
|
102
157
|
}
|
|
103
158
|
|
|
104
159
|
export interface PaymentServiceController {
|
|
@@ -125,6 +180,10 @@ export interface PaymentServiceController {
|
|
|
125
180
|
deletePaymentMethod(
|
|
126
181
|
request: DeletePaymentMethodRequest,
|
|
127
182
|
): Promise<DeletePaymentMethodResponse> | Observable<DeletePaymentMethodResponse> | DeletePaymentMethodResponse;
|
|
183
|
+
|
|
184
|
+
getUserPayments(
|
|
185
|
+
request: GetUserPaymentsRequest,
|
|
186
|
+
): Promise<GetUserPaymentsResponse> | Observable<GetUserPaymentsResponse> | GetUserPaymentsResponse;
|
|
128
187
|
}
|
|
129
188
|
|
|
130
189
|
export function PaymentServiceControllerMethods() {
|
|
@@ -136,6 +195,7 @@ export function PaymentServiceControllerMethods() {
|
|
|
136
195
|
"createPaymentMethod",
|
|
137
196
|
"verifyPaymentMethod",
|
|
138
197
|
"deletePaymentMethod",
|
|
198
|
+
"getUserPayments",
|
|
139
199
|
];
|
|
140
200
|
for (const method of grpcMethods) {
|
|
141
201
|
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.
|
|
3
|
+
"version": "1.3.11",
|
|
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
|
}
|
package/proto/payment.proto
CHANGED
|
@@ -10,6 +10,8 @@ service PaymentService {
|
|
|
10
10
|
rpc CreatePaymentMethod (CreatePaymentMethodRequest) returns (CreatePaymentMethodResponse);
|
|
11
11
|
rpc VerifyPaymentMethod (VerifyPaymentMethodRequest) returns (VerifyPaymentMethodResponse);
|
|
12
12
|
rpc DeletePaymentMethod (DeletePaymentMethodRequest) returns (DeletePaymentMethodResponse);
|
|
13
|
+
|
|
14
|
+
rpc GetUserPayments (GetUserPaymentsRequest) returns (GetUserPaymentsResponse);
|
|
13
15
|
}
|
|
14
16
|
|
|
15
17
|
// Запрос на пополнение баланса
|
|
@@ -84,3 +86,36 @@ message PaymentMethodItem {
|
|
|
84
86
|
string first6 = 4;
|
|
85
87
|
string last4 = 5;
|
|
86
88
|
}
|
|
89
|
+
|
|
90
|
+
// История платежей пользователя
|
|
91
|
+
message GetUserPaymentsRequest {
|
|
92
|
+
string user_id = 1;
|
|
93
|
+
optional PaymentStatus status = 2; // фильтр по статусу (опционально)
|
|
94
|
+
optional int32 limit = 3; // количество записей (по умолчанию 20, максимум 100)
|
|
95
|
+
optional int32 offset = 4; // смещение для пагинации (по умолчанию 0)
|
|
96
|
+
optional string cursor = 5; // курсор для курсорной пагинации (альтернатива offset)
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
message GetUserPaymentsResponse {
|
|
100
|
+
repeated PaymentItem payments = 1;
|
|
101
|
+
int32 total = 2; // общее количество платежей
|
|
102
|
+
bool has_more = 3; // есть ли еще записи
|
|
103
|
+
optional string next_cursor = 4; // курсор для следующей страницы
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
message PaymentItem {
|
|
107
|
+
string id = 1;
|
|
108
|
+
int64 amount = 2; // сумма в минимальных единицах (копейки)
|
|
109
|
+
PaymentStatus status = 3;
|
|
110
|
+
optional string provider_id = 4; // ID платежа в провайдере (YooKassa)
|
|
111
|
+
string created_at = 5; // ISO 8601 timestamp
|
|
112
|
+
string updated_at = 6; // ISO 8601 timestamp
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
enum PaymentStatus {
|
|
116
|
+
PAYMENT_STATUS_UNSPECIFIED = 0;
|
|
117
|
+
PAYMENT_STATUS_PENDING = 1;
|
|
118
|
+
PAYMENT_STATUS_SUCCESS = 2;
|
|
119
|
+
PAYMENT_STATUS_FAILED = 3;
|
|
120
|
+
PAYMENT_STATUS_REFUNDED = 4;
|
|
121
|
+
}
|