@barumetric/contracts 1.3.7 → 1.3.8

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.
@@ -8,4 +8,5 @@ export declare const PROTO_PATHS: {
8
8
  readonly PRESENCE: string;
9
9
  readonly AD: string;
10
10
  readonly PAYMENT: string;
11
+ readonly BALANCE: string;
11
12
  };
@@ -12,4 +12,5 @@ exports.PROTO_PATHS = {
12
12
  PRESENCE: (0, path_1.join)(__dirname, "../../proto/presence.proto"),
13
13
  AD: (0, path_1.join)(__dirname, "../../proto/ad.proto"),
14
14
  PAYMENT: (0, path_1.join)(__dirname, "../../proto/payment.proto"),
15
+ BALANCE: (0, path_1.join)(__dirname, "../../proto/balance.proto"),
15
16
  };
@@ -0,0 +1,67 @@
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: balance.proto
6
+
7
+ /* eslint-disable */
8
+ import { GrpcMethod, GrpcStreamMethod } from "@nestjs/microservices";
9
+ import { Observable } from "rxjs";
10
+
11
+ export const protobufPackage = "balance.v1";
12
+
13
+ export interface CreateUserBalanceRequest {
14
+ userId: string;
15
+ }
16
+
17
+ export interface CreateUserBalanceResponse {
18
+ ok: boolean;
19
+ }
20
+
21
+ export interface GetUserBalanceRequest {
22
+ userId: string;
23
+ }
24
+
25
+ export interface GetUserBalanceResponse {
26
+ balance: UserBalance | undefined;
27
+ }
28
+
29
+ export interface UserBalance {
30
+ balance: number;
31
+ version: number;
32
+ }
33
+
34
+ export const BALANCE_V1_PACKAGE_NAME = "balance.v1";
35
+
36
+ export interface BalanceServiceClient {
37
+ createUserBalance(request: CreateUserBalanceRequest): Observable<CreateUserBalanceResponse>;
38
+
39
+ getUserBalance(request: GetUserBalanceRequest): Observable<GetUserBalanceResponse>;
40
+ }
41
+
42
+ export interface BalanceServiceController {
43
+ createUserBalance(
44
+ request: CreateUserBalanceRequest,
45
+ ): Promise<CreateUserBalanceResponse> | Observable<CreateUserBalanceResponse> | CreateUserBalanceResponse;
46
+
47
+ getUserBalance(
48
+ request: GetUserBalanceRequest,
49
+ ): Promise<GetUserBalanceResponse> | Observable<GetUserBalanceResponse> | GetUserBalanceResponse;
50
+ }
51
+
52
+ export function BalanceServiceControllerMethods() {
53
+ return function (constructor: Function) {
54
+ const grpcMethods: string[] = ["createUserBalance", "getUserBalance"];
55
+ for (const method of grpcMethods) {
56
+ const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
57
+ GrpcMethod("BalanceService", method)(constructor.prototype[method], method, descriptor);
58
+ }
59
+ const grpcStreamMethods: string[] = [];
60
+ for (const method of grpcStreamMethods) {
61
+ const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
62
+ GrpcStreamMethod("BalanceService", method)(constructor.prototype[method], method, descriptor);
63
+ }
64
+ };
65
+ }
66
+
67
+ export const BALANCE_SERVICE_NAME = "BalanceService";
package/gen/ts/payment.ts CHANGED
@@ -10,15 +10,6 @@ import { Observable } from "rxjs";
10
10
 
11
11
  export const protobufPackage = "payment.v1";
12
12
 
13
- export interface CreateUserBalanceRequest {
14
- userId: string;
15
- }
16
-
17
- /** Ответ — ссылка на оплату */
18
- export interface CreateUserBalanceResponse {
19
- ok: boolean;
20
- }
21
-
22
13
  /** Запрос на пополнение баланса */
23
14
  export interface TopUpBalanceRequest {
24
15
  userId: string;
@@ -97,8 +88,6 @@ export interface PaymentMethodItem {
97
88
  export const PAYMENT_V1_PACKAGE_NAME = "payment.v1";
98
89
 
99
90
  export interface PaymentServiceClient {
100
- createUserBalance(request: CreateUserBalanceRequest): Observable<CreateUserBalanceResponse>;
101
-
102
91
  topUpBalance(request: TopUpBalanceRequest): Observable<TopUpBalanceResponse>;
103
92
 
104
93
  processPaymentEvent(request: ProcessPaymentEventRequest): Observable<ProcessPaymentEventResponse>;
@@ -113,10 +102,6 @@ export interface PaymentServiceClient {
113
102
  }
114
103
 
115
104
  export interface PaymentServiceController {
116
- createUserBalance(
117
- request: CreateUserBalanceRequest,
118
- ): Promise<CreateUserBalanceResponse> | Observable<CreateUserBalanceResponse> | CreateUserBalanceResponse;
119
-
120
105
  topUpBalance(
121
106
  request: TopUpBalanceRequest,
122
107
  ): Promise<TopUpBalanceResponse> | Observable<TopUpBalanceResponse> | TopUpBalanceResponse;
@@ -145,7 +130,6 @@ export interface PaymentServiceController {
145
130
  export function PaymentServiceControllerMethods() {
146
131
  return function (constructor: Function) {
147
132
  const grpcMethods: string[] = [
148
- "createUserBalance",
149
133
  "topUpBalance",
150
134
  "processPaymentEvent",
151
135
  "getUserPaymentMethods",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@barumetric/contracts",
3
- "version": "1.3.7",
3
+ "version": "1.3.8",
4
4
  "description": "Protobuf definitions and generated TypeScript types",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",
@@ -0,0 +1,29 @@
1
+ syntax = "proto3";
2
+
3
+ package balance.v1;
4
+
5
+ service BalanceService {
6
+ rpc CreateUserBalance (CreateUserBalanceRequest) returns (CreateUserBalanceResponse);
7
+ rpc GetUserBalance (GetUserBalanceRequest) returns (GetUserBalanceResponse);
8
+ }
9
+
10
+ message CreateUserBalanceRequest {
11
+ string user_id = 1;
12
+ }
13
+
14
+ message CreateUserBalanceResponse {
15
+ bool ok = 1;
16
+ }
17
+
18
+ message GetUserBalanceRequest {
19
+ string user_id = 1;
20
+ }
21
+
22
+ message GetUserBalanceResponse {
23
+ UserBalance balance = 1;
24
+ }
25
+
26
+ message UserBalance {
27
+ int32 balance = 1;
28
+ int32 version = 2;
29
+ }
@@ -3,8 +3,6 @@ syntax = "proto3";
3
3
  package payment.v1;
4
4
 
5
5
  service PaymentService {
6
- rpc CreateUserBalance (CreateUserBalanceRequest) returns (CreateUserBalanceResponse);
7
-
8
6
  rpc TopUpBalance (TopUpBalanceRequest) returns (TopUpBalanceResponse);
9
7
  rpc ProcessPaymentEvent (ProcessPaymentEventRequest) returns (ProcessPaymentEventResponse);
10
8
 
@@ -14,15 +12,6 @@ service PaymentService {
14
12
  rpc DeletePaymentMethod (DeletePaymentMethodRequest) returns (DeletePaymentMethodResponse);
15
13
  }
16
14
 
17
- message CreateUserBalanceRequest {
18
- string user_id = 1;
19
- }
20
-
21
- // Ответ — ссылка на оплату
22
- message CreateUserBalanceResponse {
23
- bool ok = 1;
24
- }
25
-
26
15
  // Запрос на пополнение баланса
27
16
  message TopUpBalanceRequest {
28
17
  string user_id = 1;