@airticketss/contracts 1.3.0 → 1.3.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 +80 -0
- package/gen/ts/plane.ts +0 -1
- package/gen/ts/seat.ts +4 -4
- package/package.json +1 -1
- package/proto/payment.proto +40 -0
- package/proto/plane.proto +0 -1
- package/proto/seat.proto +3 -3
package/dist/proto/paths.d.ts
CHANGED
package/dist/proto/paths.js
CHANGED
|
@@ -11,4 +11,5 @@ exports.PROTO_PATHS = {
|
|
|
11
11
|
AIRPORT: (0, path_1.join)(__dirname, "../../proto/airport.proto"),
|
|
12
12
|
PLANE: (0, path_1.join)(__dirname, "../../proto/plane.proto"),
|
|
13
13
|
SEAT: (0, path_1.join)(__dirname, "../../proto/seat.proto"),
|
|
14
|
+
PAYMENT: (0, path_1.join)(__dirname, "../../proto/payment.proto"),
|
|
14
15
|
};
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
|
|
2
|
+
// versions:
|
|
3
|
+
// protoc-gen-ts_proto v2.12.4
|
|
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
|
+
flightId: 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
|
+
providerPaymentId: 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
|
+
Object.defineProperty(constructor.prototype, method, descriptor);
|
|
70
|
+
}
|
|
71
|
+
const grpcStreamMethods: string[] = [];
|
|
72
|
+
for (const method of grpcStreamMethods) {
|
|
73
|
+
const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
|
|
74
|
+
GrpcStreamMethod("PaymentService", method)(constructor.prototype[method], method, descriptor);
|
|
75
|
+
Object.defineProperty(constructor.prototype, method, descriptor);
|
|
76
|
+
}
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
export const PAYMENT_SERVICE_NAME = "PaymentService";
|
package/gen/ts/plane.ts
CHANGED
package/gen/ts/seat.ts
CHANGED
|
@@ -24,7 +24,7 @@ export interface ListSeatsRequest {
|
|
|
24
24
|
}
|
|
25
25
|
|
|
26
26
|
export interface ListSeatsResponse {
|
|
27
|
-
|
|
27
|
+
seats: Seat[];
|
|
28
28
|
}
|
|
29
29
|
|
|
30
30
|
export interface Seat {
|
|
@@ -42,20 +42,20 @@ export const SEAT_V1_PACKAGE_NAME = "seat.v1";
|
|
|
42
42
|
export interface SeatServiceClient {
|
|
43
43
|
getSeat(request: GetSeatRequest): Observable<GetSeatResponse>;
|
|
44
44
|
|
|
45
|
-
|
|
45
|
+
listSeatsByPlane(request: ListSeatsRequest): Observable<ListSeatsResponse>;
|
|
46
46
|
}
|
|
47
47
|
|
|
48
48
|
export interface SeatServiceController {
|
|
49
49
|
getSeat(request: GetSeatRequest): Promise<GetSeatResponse> | Observable<GetSeatResponse> | GetSeatResponse;
|
|
50
50
|
|
|
51
|
-
|
|
51
|
+
listSeatsByPlane(
|
|
52
52
|
request: ListSeatsRequest,
|
|
53
53
|
): Promise<ListSeatsResponse> | Observable<ListSeatsResponse> | ListSeatsResponse;
|
|
54
54
|
}
|
|
55
55
|
|
|
56
56
|
export function SeatServiceControllerMethods() {
|
|
57
57
|
return function (constructor: Function) {
|
|
58
|
-
const grpcMethods: string[] = ["getSeat", "
|
|
58
|
+
const grpcMethods: string[] = ["getSeat", "listSeatsByPlane"];
|
|
59
59
|
for (const method of grpcMethods) {
|
|
60
60
|
const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
|
|
61
61
|
GrpcMethod("SeatService", method)(constructor.prototype[method], method, descriptor);
|
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 flight_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_payment_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
|
+
}
|
package/proto/plane.proto
CHANGED
package/proto/seat.proto
CHANGED
|
@@ -4,14 +4,14 @@ package seat.v1;
|
|
|
4
4
|
|
|
5
5
|
service SeatService {
|
|
6
6
|
rpc GetSeat (GetSeatRequest) returns (GetSeatResponse);
|
|
7
|
-
rpc
|
|
7
|
+
rpc ListSeatsByPlane (ListSeatsRequest) returns (ListSeatsResponse);
|
|
8
8
|
}
|
|
9
9
|
|
|
10
10
|
message GetSeatRequest {
|
|
11
11
|
string id = 1;
|
|
12
12
|
}
|
|
13
13
|
|
|
14
|
-
message
|
|
14
|
+
message GetSeatResponse {
|
|
15
15
|
Seat seat = 1;
|
|
16
16
|
}
|
|
17
17
|
|
|
@@ -21,7 +21,7 @@ message ListSeatsRequest {
|
|
|
21
21
|
}
|
|
22
22
|
|
|
23
23
|
message ListSeatsResponse {
|
|
24
|
-
repeated Seat
|
|
24
|
+
repeated Seat seats = 1;
|
|
25
25
|
}
|
|
26
26
|
|
|
27
27
|
message Seat {
|