@barumetric/contracts 1.3.7 → 1.3.9
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/dist/events/balance/index.d.ts +1 -0
- package/dist/events/balance/index.js +17 -0
- package/dist/events/balance/top-up.interface.d.ts +4 -0
- package/dist/events/balance/top-up.interface.js +2 -0
- package/dist/events/index.d.ts +1 -0
- package/dist/events/index.js +1 -0
- package/dist/proto/paths.d.ts +1 -0
- package/dist/proto/paths.js +1 -0
- package/gen/ts/balance.ts +67 -0
- package/gen/ts/payment.ts +0 -16
- package/package.json +1 -1
- package/proto/balance.proto +29 -0
- package/proto/payment.proto +0 -11
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./top-up.interface";
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./top-up.interface"), exports);
|
package/dist/events/index.d.ts
CHANGED
package/dist/events/index.js
CHANGED
|
@@ -16,3 +16,4 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
__exportStar(require("./account"), exports);
|
|
18
18
|
__exportStar(require("./auth"), exports);
|
|
19
|
+
__exportStar(require("./balance"), exports);
|
package/dist/proto/paths.d.ts
CHANGED
package/dist/proto/paths.js
CHANGED
|
@@ -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
|
@@ -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
|
+
}
|
package/proto/payment.proto
CHANGED
|
@@ -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;
|