@teacinema/contracts 1.4.0 → 1.4.2
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 +78 -0
- package/package.json +1 -1
- package/proto/payment.proto +40 -0
package/dist/proto/paths.d.ts
CHANGED
package/dist/proto/paths.js
CHANGED
|
@@ -13,4 +13,5 @@ exports.PROTO_PATHS = {
|
|
|
13
13
|
HALL: (0, path_1.join)(__dirname, '../../proto/hall.proto'),
|
|
14
14
|
SEAT: (0, path_1.join)(__dirname, '../../proto/seat.proto'),
|
|
15
15
|
SCREENING: (0, path_1.join)(__dirname, '../../proto/screening.proto'),
|
|
16
|
+
PAYMENT: (0, path_1.join)(__dirname, '../../proto/payment.proto'),
|
|
16
17
|
};
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
|
|
2
|
+
// versions:
|
|
3
|
+
// protoc-gen-ts_proto v2.8.3
|
|
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 CreatePaymentRequest {
|
|
14
|
+
userId: string;
|
|
15
|
+
screeningId: string;
|
|
16
|
+
seats: SeatInput[];
|
|
17
|
+
paymentMethodId?: string | undefined;
|
|
18
|
+
savePaymentMethod: boolean;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export interface CreatePaymentResponse {
|
|
22
|
+
url: string;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export interface ProcessPaymentEventRequest {
|
|
26
|
+
event: string;
|
|
27
|
+
paymentId: string;
|
|
28
|
+
bookingId: string;
|
|
29
|
+
userId: string;
|
|
30
|
+
savePaymentMethod: boolean;
|
|
31
|
+
providerMethodId: string;
|
|
32
|
+
cardFirst6: string;
|
|
33
|
+
cardLast4: string;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export interface ProcessPaymentEventResponse {
|
|
37
|
+
ok: boolean;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export interface SeatInput {
|
|
41
|
+
seatId: string;
|
|
42
|
+
price: number;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export const PAYMENT_V1_PACKAGE_NAME = "payment.v1";
|
|
46
|
+
|
|
47
|
+
export interface PaymentServiceClient {
|
|
48
|
+
createPayment(request: CreatePaymentRequest): Observable<CreatePaymentResponse>;
|
|
49
|
+
|
|
50
|
+
processPaymentEvent(request: ProcessPaymentEventRequest): Observable<ProcessPaymentEventResponse>;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export interface PaymentServiceController {
|
|
54
|
+
createPayment(
|
|
55
|
+
request: CreatePaymentRequest,
|
|
56
|
+
): Promise<CreatePaymentResponse> | Observable<CreatePaymentResponse> | CreatePaymentResponse;
|
|
57
|
+
|
|
58
|
+
processPaymentEvent(
|
|
59
|
+
request: ProcessPaymentEventRequest,
|
|
60
|
+
): Promise<ProcessPaymentEventResponse> | Observable<ProcessPaymentEventResponse> | ProcessPaymentEventResponse;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
export function PaymentServiceControllerMethods() {
|
|
64
|
+
return function (constructor: Function) {
|
|
65
|
+
const grpcMethods: string[] = ["createPayment", "processPaymentEvent"];
|
|
66
|
+
for (const method of grpcMethods) {
|
|
67
|
+
const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
|
|
68
|
+
GrpcMethod("PaymentService", method)(constructor.prototype[method], method, descriptor);
|
|
69
|
+
}
|
|
70
|
+
const grpcStreamMethods: string[] = [];
|
|
71
|
+
for (const method of grpcStreamMethods) {
|
|
72
|
+
const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
|
|
73
|
+
GrpcStreamMethod("PaymentService", method)(constructor.prototype[method], method, descriptor);
|
|
74
|
+
}
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
export const PAYMENT_SERVICE_NAME = "PaymentService";
|
package/package.json
CHANGED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
syntax = "proto3";
|
|
2
|
+
|
|
3
|
+
package payment.v1;
|
|
4
|
+
|
|
5
|
+
service PaymentService {
|
|
6
|
+
rpc CreatePayment (CreatePaymentRequest) returns (CreatePaymentResponse);
|
|
7
|
+
rpc ProcessPaymentEvent (ProcessPaymentEventRequest) returns (ProcessPaymentEventResponse);
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
message CreatePaymentRequest {
|
|
11
|
+
string user_id = 1;
|
|
12
|
+
string screening_id = 2;
|
|
13
|
+
repeated SeatInput seats = 3;
|
|
14
|
+
optional string payment_method_id = 4;
|
|
15
|
+
bool save_payment_method = 5;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
message CreatePaymentResponse {
|
|
19
|
+
string url = 1;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
message ProcessPaymentEventRequest {
|
|
23
|
+
string event = 1;
|
|
24
|
+
string payment_id = 2;
|
|
25
|
+
string booking_id = 3;
|
|
26
|
+
string user_id = 4;
|
|
27
|
+
bool save_payment_method = 5;
|
|
28
|
+
string provider_method_id = 6;
|
|
29
|
+
string card_first6 = 7;
|
|
30
|
+
string card_last4 = 8;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
message ProcessPaymentEventResponse {
|
|
34
|
+
bool ok = 1;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
message SeatInput {
|
|
38
|
+
string seat_id = 1;
|
|
39
|
+
int32 price = 2;
|
|
40
|
+
}
|