@usteam/contracts 1.4.5 → 1.5.0
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/proto/paths.d.ts +1 -0
- package/dist/proto/paths.js +1 -0
- package/gen/ts/payment.ts +97 -5
- package/gen/ts/refund.ts +73 -0
- package/package.json +1 -1
- package/proto/payment.proto +57 -5
- package/proto/refund.proto +29 -0
package/dist/proto/paths.d.ts
CHANGED
package/dist/proto/paths.js
CHANGED
|
@@ -14,4 +14,5 @@ exports.PROTO_PATHS = {
|
|
|
14
14
|
SEAT: (0, path_1.join)(__dirname, '../../proto/seat.proto'),
|
|
15
15
|
SCREENING: (0, path_1.join)(__dirname, '../../proto/screening.proto'),
|
|
16
16
|
PAYMENT: (0, path_1.join)(__dirname, '../../proto/payment.proto'),
|
|
17
|
+
REFUND: (0, path_1.join)(__dirname, '../../proto/refund.proto'),
|
|
17
18
|
};
|
package/gen/ts/payment.ts
CHANGED
|
@@ -30,14 +30,59 @@ export interface ProcessPaymentEventRequest {
|
|
|
30
30
|
userId: string;
|
|
31
31
|
savePaymentMethod: boolean;
|
|
32
32
|
providerMethodId: string;
|
|
33
|
-
|
|
34
|
-
|
|
33
|
+
cardFirst6: string;
|
|
34
|
+
cardLast4: string;
|
|
35
|
+
bank: string;
|
|
36
|
+
brand: string;
|
|
35
37
|
}
|
|
36
38
|
|
|
37
39
|
export interface ProcessPaymentEventResponse {
|
|
38
40
|
ok: boolean;
|
|
39
41
|
}
|
|
40
42
|
|
|
43
|
+
export interface GetUserPaymentMethodsRequest {
|
|
44
|
+
userId: string;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
export interface GetUserPaymentMethodsResponse {
|
|
48
|
+
methods: PaymentMethodItem[];
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export interface CreatePaymentMethodRequest {
|
|
52
|
+
userId: string;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
export interface CreatePaymentMethodResponse {
|
|
56
|
+
id: string;
|
|
57
|
+
url: string;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
export interface VerifyPaymentMethodRequest {
|
|
61
|
+
userId: string;
|
|
62
|
+
methodId: string;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
export interface VerifyPaymentMethodResponse {
|
|
66
|
+
ok: boolean;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
export interface DeletePaymentMethodRequest {
|
|
70
|
+
userId: string;
|
|
71
|
+
methodId: string;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
export interface DeletePaymentMethodResponse {
|
|
75
|
+
ok: boolean;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
export interface PaymentMethodItem {
|
|
79
|
+
id: string;
|
|
80
|
+
bank: string;
|
|
81
|
+
brand: string;
|
|
82
|
+
first6: string;
|
|
83
|
+
last4: string;
|
|
84
|
+
}
|
|
85
|
+
|
|
41
86
|
export interface SeatInput {
|
|
42
87
|
seatId: string;
|
|
43
88
|
price: number;
|
|
@@ -50,9 +95,25 @@ export interface PaymentServiceClient {
|
|
|
50
95
|
|
|
51
96
|
createPayment(request: CreatePaymentRequest): Observable<CreatePaymentResponse>;
|
|
52
97
|
|
|
53
|
-
/** Обработка
|
|
98
|
+
/** Обработка (начисление брони) от платежной системы */
|
|
54
99
|
|
|
55
100
|
processPaymentEvent(request: ProcessPaymentEventRequest): Observable<ProcessPaymentEventResponse>;
|
|
101
|
+
|
|
102
|
+
/** */
|
|
103
|
+
|
|
104
|
+
getUserPaymentMethods(request: GetUserPaymentMethodsRequest): Observable<GetUserPaymentMethodsResponse>;
|
|
105
|
+
|
|
106
|
+
/** */
|
|
107
|
+
|
|
108
|
+
createPaymentMethod(request: CreatePaymentMethodRequest): Observable<CreatePaymentMethodResponse>;
|
|
109
|
+
|
|
110
|
+
/** */
|
|
111
|
+
|
|
112
|
+
verifyPaymentMethod(request: VerifyPaymentMethodRequest): Observable<VerifyPaymentMethodResponse>;
|
|
113
|
+
|
|
114
|
+
/** */
|
|
115
|
+
|
|
116
|
+
deletePaymentMethod(request: DeletePaymentMethodRequest): Observable<DeletePaymentMethodResponse>;
|
|
56
117
|
}
|
|
57
118
|
|
|
58
119
|
export interface PaymentServiceController {
|
|
@@ -62,16 +123,47 @@ export interface PaymentServiceController {
|
|
|
62
123
|
request: CreatePaymentRequest,
|
|
63
124
|
): Promise<CreatePaymentResponse> | Observable<CreatePaymentResponse> | CreatePaymentResponse;
|
|
64
125
|
|
|
65
|
-
/** Обработка
|
|
126
|
+
/** Обработка (начисление брони) от платежной системы */
|
|
66
127
|
|
|
67
128
|
processPaymentEvent(
|
|
68
129
|
request: ProcessPaymentEventRequest,
|
|
69
130
|
): Promise<ProcessPaymentEventResponse> | Observable<ProcessPaymentEventResponse> | ProcessPaymentEventResponse;
|
|
131
|
+
|
|
132
|
+
/** */
|
|
133
|
+
|
|
134
|
+
getUserPaymentMethods(
|
|
135
|
+
request: GetUserPaymentMethodsRequest,
|
|
136
|
+
): Promise<GetUserPaymentMethodsResponse> | Observable<GetUserPaymentMethodsResponse> | GetUserPaymentMethodsResponse;
|
|
137
|
+
|
|
138
|
+
/** */
|
|
139
|
+
|
|
140
|
+
createPaymentMethod(
|
|
141
|
+
request: CreatePaymentMethodRequest,
|
|
142
|
+
): Promise<CreatePaymentMethodResponse> | Observable<CreatePaymentMethodResponse> | CreatePaymentMethodResponse;
|
|
143
|
+
|
|
144
|
+
/** */
|
|
145
|
+
|
|
146
|
+
verifyPaymentMethod(
|
|
147
|
+
request: VerifyPaymentMethodRequest,
|
|
148
|
+
): Promise<VerifyPaymentMethodResponse> | Observable<VerifyPaymentMethodResponse> | VerifyPaymentMethodResponse;
|
|
149
|
+
|
|
150
|
+
/** */
|
|
151
|
+
|
|
152
|
+
deletePaymentMethod(
|
|
153
|
+
request: DeletePaymentMethodRequest,
|
|
154
|
+
): Promise<DeletePaymentMethodResponse> | Observable<DeletePaymentMethodResponse> | DeletePaymentMethodResponse;
|
|
70
155
|
}
|
|
71
156
|
|
|
72
157
|
export function PaymentServiceControllerMethods() {
|
|
73
158
|
return function (constructor: Function) {
|
|
74
|
-
const grpcMethods: string[] = [
|
|
159
|
+
const grpcMethods: string[] = [
|
|
160
|
+
"createPayment",
|
|
161
|
+
"processPaymentEvent",
|
|
162
|
+
"getUserPaymentMethods",
|
|
163
|
+
"createPaymentMethod",
|
|
164
|
+
"verifyPaymentMethod",
|
|
165
|
+
"deletePaymentMethod",
|
|
166
|
+
];
|
|
75
167
|
for (const method of grpcMethods) {
|
|
76
168
|
const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
|
|
77
169
|
GrpcMethod("PaymentService", method)(constructor.prototype[method], method, descriptor);
|
package/gen/ts/refund.ts
ADDED
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
|
|
2
|
+
// versions:
|
|
3
|
+
// protoc-gen-ts_proto v2.10.1
|
|
4
|
+
// protoc v4.25.9
|
|
5
|
+
// source: refund.proto
|
|
6
|
+
|
|
7
|
+
/* eslint-disable */
|
|
8
|
+
import { GrpcMethod, GrpcStreamMethod } from "@nestjs/microservices";
|
|
9
|
+
import { Observable } from "rxjs";
|
|
10
|
+
|
|
11
|
+
export const protobufPackage = "refund.v1";
|
|
12
|
+
|
|
13
|
+
export interface CreateRefundRequest {
|
|
14
|
+
bookingId: string;
|
|
15
|
+
userId: string;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export interface CreateRefundResponse {
|
|
19
|
+
ok: boolean;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export interface ProcessRefundEventRequest {
|
|
23
|
+
event: string;
|
|
24
|
+
providerRefundId: string;
|
|
25
|
+
status: string;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export interface ProcessRefundEventResponse {
|
|
29
|
+
ok: boolean;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export const REFUND_V1_PACKAGE_NAME = "refund.v1";
|
|
33
|
+
|
|
34
|
+
export interface RefundServiceClient {
|
|
35
|
+
/** Создание возврата */
|
|
36
|
+
|
|
37
|
+
createRefund(request: CreateRefundRequest): Observable<CreateRefundResponse>;
|
|
38
|
+
|
|
39
|
+
/** Обработка (снятие брони) от платежной системы */
|
|
40
|
+
|
|
41
|
+
processRefundEvent(request: ProcessRefundEventRequest): Observable<ProcessRefundEventResponse>;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export interface RefundServiceController {
|
|
45
|
+
/** Создание возврата */
|
|
46
|
+
|
|
47
|
+
createRefund(
|
|
48
|
+
request: CreateRefundRequest,
|
|
49
|
+
): Promise<CreateRefundResponse> | Observable<CreateRefundResponse> | CreateRefundResponse;
|
|
50
|
+
|
|
51
|
+
/** Обработка (снятие брони) от платежной системы */
|
|
52
|
+
|
|
53
|
+
processRefundEvent(
|
|
54
|
+
request: ProcessRefundEventRequest,
|
|
55
|
+
): Promise<ProcessRefundEventResponse> | Observable<ProcessRefundEventResponse> | ProcessRefundEventResponse;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
export function RefundServiceControllerMethods() {
|
|
59
|
+
return function (constructor: Function) {
|
|
60
|
+
const grpcMethods: string[] = ["createRefund", "processRefundEvent"];
|
|
61
|
+
for (const method of grpcMethods) {
|
|
62
|
+
const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
|
|
63
|
+
GrpcMethod("RefundService", method)(constructor.prototype[method], method, descriptor);
|
|
64
|
+
}
|
|
65
|
+
const grpcStreamMethods: string[] = [];
|
|
66
|
+
for (const method of grpcStreamMethods) {
|
|
67
|
+
const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
|
|
68
|
+
GrpcStreamMethod("RefundService", method)(constructor.prototype[method], method, descriptor);
|
|
69
|
+
}
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
export const REFUND_SERVICE_NAME = "RefundService";
|
package/package.json
CHANGED
package/proto/payment.proto
CHANGED
|
@@ -3,11 +3,18 @@ syntax = "proto3";
|
|
|
3
3
|
package payment.v1;
|
|
4
4
|
|
|
5
5
|
service PaymentService {
|
|
6
|
-
|
|
6
|
+
// Создание платежа
|
|
7
7
|
rpc CreatePayment (CreatePaymentRequest) returns (CreatePaymentResponse);
|
|
8
|
-
// Обработка
|
|
8
|
+
// Обработка (начисление брони) от платежной системы
|
|
9
9
|
rpc ProcessPaymentEvent (ProcessPaymentEventRequest) returns (ProcessPaymentEventResponse);
|
|
10
|
-
//
|
|
10
|
+
//
|
|
11
|
+
rpc GetUserPaymentMethods (GetUserPaymentMethodsRequest) returns (GetUserPaymentMethodsResponse);
|
|
12
|
+
//
|
|
13
|
+
rpc CreatePaymentMethod (CreatePaymentMethodRequest) returns (CreatePaymentMethodResponse);
|
|
14
|
+
//
|
|
15
|
+
rpc VerifyPaymentMethod (VerifyPaymentMethodRequest) returns (VerifyPaymentMethodResponse);
|
|
16
|
+
//
|
|
17
|
+
rpc DeletePaymentMethod (DeletePaymentMethodRequest) returns (DeletePaymentMethodResponse);
|
|
11
18
|
|
|
12
19
|
}
|
|
13
20
|
message CreatePaymentRequest {
|
|
@@ -29,14 +36,59 @@ message ProcessPaymentEventRequest {
|
|
|
29
36
|
string user_id = 4;
|
|
30
37
|
bool save_payment_method = 5;
|
|
31
38
|
string provider_method_id = 6;
|
|
32
|
-
string
|
|
33
|
-
string
|
|
39
|
+
string card_first6 = 7;
|
|
40
|
+
string card_last4 = 8;
|
|
41
|
+
string bank = 9;
|
|
42
|
+
string brand = 10;
|
|
34
43
|
}
|
|
35
44
|
|
|
36
45
|
message ProcessPaymentEventResponse {
|
|
37
46
|
bool ok = 1;
|
|
38
47
|
}
|
|
39
48
|
|
|
49
|
+
message GetUserPaymentMethodsRequest {
|
|
50
|
+
string user_id = 1;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
message GetUserPaymentMethodsResponse {
|
|
54
|
+
repeated PaymentMethodItem methods = 1;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
message CreatePaymentMethodRequest {
|
|
58
|
+
string user_id = 1;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
message CreatePaymentMethodResponse {
|
|
62
|
+
string id = 1;
|
|
63
|
+
string url = 2;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
message VerifyPaymentMethodRequest {
|
|
67
|
+
string user_id = 1;
|
|
68
|
+
string method_id = 2;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
message VerifyPaymentMethodResponse {
|
|
72
|
+
bool ok = 1;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
message DeletePaymentMethodRequest {
|
|
76
|
+
string user_id = 1;
|
|
77
|
+
string method_id = 2;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
message DeletePaymentMethodResponse {
|
|
81
|
+
bool ok = 1;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
message PaymentMethodItem {
|
|
85
|
+
string id = 1;
|
|
86
|
+
string bank = 2;
|
|
87
|
+
string brand = 3;
|
|
88
|
+
string first6 = 4;
|
|
89
|
+
string last4 = 5;
|
|
90
|
+
}
|
|
91
|
+
|
|
40
92
|
message SeatInput {
|
|
41
93
|
string seat_id = 1;
|
|
42
94
|
int32 price = 2;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
syntax = "proto3";
|
|
2
|
+
|
|
3
|
+
package refund.v1;
|
|
4
|
+
|
|
5
|
+
service RefundService {
|
|
6
|
+
// Создание возврата
|
|
7
|
+
rpc CreateRefund (CreateRefundRequest) returns (CreateRefundResponse);
|
|
8
|
+
// Обработка (снятие брони) от платежной системы
|
|
9
|
+
rpc ProcessRefundEvent (ProcessRefundEventRequest) returns (ProcessRefundEventResponse);
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
message CreateRefundRequest {
|
|
13
|
+
string booking_id = 1;
|
|
14
|
+
string user_id = 2;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
message CreateRefundResponse {
|
|
18
|
+
bool ok = 1;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
message ProcessRefundEventRequest {
|
|
22
|
+
string event = 1;
|
|
23
|
+
string provider_refund_id = 2;
|
|
24
|
+
string status = 3;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
message ProcessRefundEventResponse {
|
|
28
|
+
bool ok = 1;
|
|
29
|
+
}
|