@barumetric/contracts 1.3.5 → 1.3.7

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.
@@ -7,4 +7,5 @@ export declare const PROTO_PATHS: {
7
7
  readonly SESSION: string;
8
8
  readonly PRESENCE: string;
9
9
  readonly AD: string;
10
+ readonly PAYMENT: string;
10
11
  };
@@ -11,4 +11,5 @@ exports.PROTO_PATHS = {
11
11
  SESSION: (0, path_1.join)(__dirname, "../../proto/session.proto"),
12
12
  PRESENCE: (0, path_1.join)(__dirname, "../../proto/presence.proto"),
13
13
  AD: (0, path_1.join)(__dirname, "../../proto/ad.proto"),
14
+ PAYMENT: (0, path_1.join)(__dirname, "../../proto/payment.proto"),
14
15
  };
package/gen/ts/account.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  // Code generated by protoc-gen-ts_proto. DO NOT EDIT.
2
2
  // versions:
3
- // protoc-gen-ts_proto v2.10.1
3
+ // protoc-gen-ts_proto v2.11.0
4
4
  // protoc v3.21.12
5
5
  // source: account.proto
6
6
 
package/gen/ts/ad.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  // Code generated by protoc-gen-ts_proto. DO NOT EDIT.
2
2
  // versions:
3
- // protoc-gen-ts_proto v2.10.1
3
+ // protoc-gen-ts_proto v2.11.0
4
4
  // protoc v3.21.12
5
5
  // source: ad.proto
6
6
 
package/gen/ts/auth.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  // Code generated by protoc-gen-ts_proto. DO NOT EDIT.
2
2
  // versions:
3
- // protoc-gen-ts_proto v2.10.1
3
+ // protoc-gen-ts_proto v2.11.0
4
4
  // protoc v3.21.12
5
5
  // source: auth.proto
6
6
 
@@ -1,6 +1,6 @@
1
1
  // Code generated by protoc-gen-ts_proto. DO NOT EDIT.
2
2
  // versions:
3
- // protoc-gen-ts_proto v2.10.1
3
+ // protoc-gen-ts_proto v2.11.0
4
4
  // protoc v3.21.12
5
5
  // source: categories.proto
6
6
 
@@ -1,6 +1,6 @@
1
1
  // Code generated by protoc-gen-ts_proto. DO NOT EDIT.
2
2
  // versions:
3
- // protoc-gen-ts_proto v2.10.1
3
+ // protoc-gen-ts_proto v2.11.0
4
4
  // protoc v3.21.12
5
5
  // source: google/protobuf/empty.proto
6
6
 
@@ -1,6 +1,6 @@
1
1
  // Code generated by protoc-gen-ts_proto. DO NOT EDIT.
2
2
  // versions:
3
- // protoc-gen-ts_proto v2.10.1
3
+ // protoc-gen-ts_proto v2.11.0
4
4
  // protoc v3.21.12
5
5
  // source: google/protobuf/timestamp.proto
6
6
 
package/gen/ts/media.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  // Code generated by protoc-gen-ts_proto. DO NOT EDIT.
2
2
  // versions:
3
- // protoc-gen-ts_proto v2.10.1
3
+ // protoc-gen-ts_proto v2.11.0
4
4
  // protoc v3.21.12
5
5
  // source: media.proto
6
6
 
@@ -0,0 +1,168 @@
1
+ // Code generated by protoc-gen-ts_proto. DO NOT EDIT.
2
+ // versions:
3
+ // protoc-gen-ts_proto v2.11.0
4
+ // protoc v3.21.12
5
+ // source: payment.proto
6
+
7
+ /* eslint-disable */
8
+ import { GrpcMethod, GrpcStreamMethod } from "@nestjs/microservices";
9
+ import { Observable } from "rxjs";
10
+
11
+ export const protobufPackage = "payment.v1";
12
+
13
+ export interface CreateUserBalanceRequest {
14
+ userId: string;
15
+ }
16
+
17
+ /** Ответ — ссылка на оплату */
18
+ export interface CreateUserBalanceResponse {
19
+ ok: boolean;
20
+ }
21
+
22
+ /** Запрос на пополнение баланса */
23
+ export interface TopUpBalanceRequest {
24
+ userId: string;
25
+ /** сумма в минимальных единицах (копейки/центы) */
26
+ amount: number;
27
+ paymentMethodId?: string | undefined;
28
+ savePaymentMethod: boolean;
29
+ }
30
+
31
+ /** Ответ — ссылка на оплату */
32
+ export interface TopUpBalanceResponse {
33
+ url: string;
34
+ }
35
+
36
+ export interface ProcessPaymentEventRequest {
37
+ /** succeeded / failed / etc */
38
+ event: string;
39
+ paymentId: string;
40
+ userId: string;
41
+ savePaymentMethod: boolean;
42
+ providerMethodId?: string | undefined;
43
+ cardFirst6?: string | undefined;
44
+ cardLast4?: string | undefined;
45
+ bank?: string | undefined;
46
+ brand?: string | undefined;
47
+ amount?: number | undefined;
48
+ }
49
+
50
+ export interface ProcessPaymentEventResponse {
51
+ ok: boolean;
52
+ }
53
+
54
+ export interface GetUserPaymentMethodsRequest {
55
+ userId: string;
56
+ }
57
+
58
+ export interface GetUserPaymentMethodsResponse {
59
+ methods: PaymentMethodItem[];
60
+ }
61
+
62
+ export interface CreatePaymentMethodRequest {
63
+ userId: string;
64
+ }
65
+
66
+ export interface CreatePaymentMethodResponse {
67
+ id: string;
68
+ url: string;
69
+ }
70
+
71
+ export interface VerifyPaymentMethodRequest {
72
+ userId: string;
73
+ methodId: string;
74
+ }
75
+
76
+ export interface VerifyPaymentMethodResponse {
77
+ ok: boolean;
78
+ }
79
+
80
+ export interface DeletePaymentMethodRequest {
81
+ userId: string;
82
+ methodId: string;
83
+ }
84
+
85
+ export interface DeletePaymentMethodResponse {
86
+ ok: boolean;
87
+ }
88
+
89
+ export interface PaymentMethodItem {
90
+ id: string;
91
+ bank: string;
92
+ brand: string;
93
+ first6: string;
94
+ last4: string;
95
+ }
96
+
97
+ export const PAYMENT_V1_PACKAGE_NAME = "payment.v1";
98
+
99
+ export interface PaymentServiceClient {
100
+ createUserBalance(request: CreateUserBalanceRequest): Observable<CreateUserBalanceResponse>;
101
+
102
+ topUpBalance(request: TopUpBalanceRequest): Observable<TopUpBalanceResponse>;
103
+
104
+ processPaymentEvent(request: ProcessPaymentEventRequest): Observable<ProcessPaymentEventResponse>;
105
+
106
+ getUserPaymentMethods(request: GetUserPaymentMethodsRequest): Observable<GetUserPaymentMethodsResponse>;
107
+
108
+ createPaymentMethod(request: CreatePaymentMethodRequest): Observable<CreatePaymentMethodResponse>;
109
+
110
+ verifyPaymentMethod(request: VerifyPaymentMethodRequest): Observable<VerifyPaymentMethodResponse>;
111
+
112
+ deletePaymentMethod(request: DeletePaymentMethodRequest): Observable<DeletePaymentMethodResponse>;
113
+ }
114
+
115
+ export interface PaymentServiceController {
116
+ createUserBalance(
117
+ request: CreateUserBalanceRequest,
118
+ ): Promise<CreateUserBalanceResponse> | Observable<CreateUserBalanceResponse> | CreateUserBalanceResponse;
119
+
120
+ topUpBalance(
121
+ request: TopUpBalanceRequest,
122
+ ): Promise<TopUpBalanceResponse> | Observable<TopUpBalanceResponse> | TopUpBalanceResponse;
123
+
124
+ processPaymentEvent(
125
+ request: ProcessPaymentEventRequest,
126
+ ): Promise<ProcessPaymentEventResponse> | Observable<ProcessPaymentEventResponse> | ProcessPaymentEventResponse;
127
+
128
+ getUserPaymentMethods(
129
+ request: GetUserPaymentMethodsRequest,
130
+ ): Promise<GetUserPaymentMethodsResponse> | Observable<GetUserPaymentMethodsResponse> | GetUserPaymentMethodsResponse;
131
+
132
+ createPaymentMethod(
133
+ request: CreatePaymentMethodRequest,
134
+ ): Promise<CreatePaymentMethodResponse> | Observable<CreatePaymentMethodResponse> | CreatePaymentMethodResponse;
135
+
136
+ verifyPaymentMethod(
137
+ request: VerifyPaymentMethodRequest,
138
+ ): Promise<VerifyPaymentMethodResponse> | Observable<VerifyPaymentMethodResponse> | VerifyPaymentMethodResponse;
139
+
140
+ deletePaymentMethod(
141
+ request: DeletePaymentMethodRequest,
142
+ ): Promise<DeletePaymentMethodResponse> | Observable<DeletePaymentMethodResponse> | DeletePaymentMethodResponse;
143
+ }
144
+
145
+ export function PaymentServiceControllerMethods() {
146
+ return function (constructor: Function) {
147
+ const grpcMethods: string[] = [
148
+ "createUserBalance",
149
+ "topUpBalance",
150
+ "processPaymentEvent",
151
+ "getUserPaymentMethods",
152
+ "createPaymentMethod",
153
+ "verifyPaymentMethod",
154
+ "deletePaymentMethod",
155
+ ];
156
+ for (const method of grpcMethods) {
157
+ const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
158
+ GrpcMethod("PaymentService", method)(constructor.prototype[method], method, descriptor);
159
+ }
160
+ const grpcStreamMethods: string[] = [];
161
+ for (const method of grpcStreamMethods) {
162
+ const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
163
+ GrpcStreamMethod("PaymentService", method)(constructor.prototype[method], method, descriptor);
164
+ }
165
+ };
166
+ }
167
+
168
+ export const PAYMENT_SERVICE_NAME = "PaymentService";
@@ -1,6 +1,6 @@
1
1
  // Code generated by protoc-gen-ts_proto. DO NOT EDIT.
2
2
  // versions:
3
- // protoc-gen-ts_proto v2.10.1
3
+ // protoc-gen-ts_proto v2.11.0
4
4
  // protoc v3.21.12
5
5
  // source: presence.proto
6
6
 
package/gen/ts/session.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  // Code generated by protoc-gen-ts_proto. DO NOT EDIT.
2
2
  // versions:
3
- // protoc-gen-ts_proto v2.10.1
3
+ // protoc-gen-ts_proto v2.11.0
4
4
  // protoc v3.21.12
5
5
  // source: session.proto
6
6
 
package/gen/ts/users.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  // Code generated by protoc-gen-ts_proto. DO NOT EDIT.
2
2
  // versions:
3
- // protoc-gen-ts_proto v2.10.1
3
+ // protoc-gen-ts_proto v2.11.0
4
4
  // protoc v3.21.12
5
5
  // source: users.proto
6
6
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@barumetric/contracts",
3
- "version": "1.3.5",
3
+ "version": "1.3.7",
4
4
  "description": "Protobuf definitions and generated TypeScript types",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",
@@ -18,11 +18,12 @@
18
18
  },
19
19
  "dependencies": {
20
20
  "@nestjs/microservices": "^11.1.9",
21
- "rxjs": "^7.8.2"
21
+ "rxjs": "^7.8.2",
22
+ "ts-proto": "^2.8.3"
22
23
  },
23
24
  "devDependencies": {
24
25
  "@types/node": "^25.0.3",
25
- "typescript": "^5.9.3",
26
- "ts-proto": "^2.8.3"
26
+ "typescript": "^5.9.3"
27
+
27
28
  }
28
29
  }
@@ -0,0 +1,97 @@
1
+ syntax = "proto3";
2
+
3
+ package payment.v1;
4
+
5
+ service PaymentService {
6
+ rpc CreateUserBalance (CreateUserBalanceRequest) returns (CreateUserBalanceResponse);
7
+
8
+ rpc TopUpBalance (TopUpBalanceRequest) returns (TopUpBalanceResponse);
9
+ rpc ProcessPaymentEvent (ProcessPaymentEventRequest) returns (ProcessPaymentEventResponse);
10
+
11
+ rpc GetUserPaymentMethods (GetUserPaymentMethodsRequest) returns (GetUserPaymentMethodsResponse);
12
+ rpc CreatePaymentMethod (CreatePaymentMethodRequest) returns (CreatePaymentMethodResponse);
13
+ rpc VerifyPaymentMethod (VerifyPaymentMethodRequest) returns (VerifyPaymentMethodResponse);
14
+ rpc DeletePaymentMethod (DeletePaymentMethodRequest) returns (DeletePaymentMethodResponse);
15
+ }
16
+
17
+ message CreateUserBalanceRequest {
18
+ string user_id = 1;
19
+ }
20
+
21
+ // Ответ — ссылка на оплату
22
+ message CreateUserBalanceResponse {
23
+ bool ok = 1;
24
+ }
25
+
26
+ // Запрос на пополнение баланса
27
+ message TopUpBalanceRequest {
28
+ string user_id = 1;
29
+ int64 amount = 2; // сумма в минимальных единицах (копейки/центы)
30
+ optional string payment_method_id = 3;
31
+ bool save_payment_method = 4;
32
+ }
33
+
34
+ // Ответ — ссылка на оплату
35
+ message TopUpBalanceResponse {
36
+ string url = 1;
37
+ }
38
+
39
+ message ProcessPaymentEventRequest {
40
+ string event = 1; // succeeded / failed / etc
41
+ string payment_id = 2;
42
+ string user_id = 4;
43
+ bool save_payment_method = 5;
44
+ optional string provider_method_id = 6;
45
+ optional string card_first6 = 7;
46
+ optional string card_last4 = 8;
47
+ optional string bank = 9;
48
+ optional string brand = 10;
49
+ optional int64 amount = 11;
50
+ }
51
+
52
+ message ProcessPaymentEventResponse {
53
+ bool ok = 1;
54
+ }
55
+
56
+ message GetUserPaymentMethodsRequest {
57
+ string user_id = 1;
58
+ }
59
+
60
+ message GetUserPaymentMethodsResponse {
61
+ repeated PaymentMethodItem methods = 1;
62
+ }
63
+
64
+ message CreatePaymentMethodRequest {
65
+ string user_id = 1;
66
+ }
67
+
68
+ message CreatePaymentMethodResponse {
69
+ string id = 1;
70
+ string url = 2;
71
+ }
72
+
73
+ message VerifyPaymentMethodRequest {
74
+ string user_id = 1;
75
+ string method_id = 2;
76
+ }
77
+
78
+ message VerifyPaymentMethodResponse {
79
+ bool ok = 1;
80
+ }
81
+
82
+ message DeletePaymentMethodRequest {
83
+ string user_id = 1;
84
+ string method_id = 2;
85
+ }
86
+
87
+ message DeletePaymentMethodResponse {
88
+ bool ok = 1;
89
+ }
90
+
91
+ message PaymentMethodItem {
92
+ string id = 1;
93
+ string bank = 2;
94
+ string brand = 3;
95
+ string first6 = 4;
96
+ string last4 = 5;
97
+ }