@teacinema/contracts 1.4.2 → 1.5.1

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.
@@ -10,4 +10,6 @@ export declare const PROTO_PATHS: {
10
10
  readonly SEAT: string;
11
11
  readonly SCREENING: string;
12
12
  readonly PAYMENT: string;
13
+ readonly REFUND: string;
14
+ readonly BOOKING: string;
13
15
  };
@@ -14,4 +14,6 @@ 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'),
18
+ BOOKING: (0, path_1.join)(__dirname, '../../proto/booking.proto'),
17
19
  };
@@ -0,0 +1,155 @@
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: booking.proto
6
+
7
+ /* eslint-disable */
8
+ import { GrpcMethod, GrpcStreamMethod } from "@nestjs/microservices";
9
+ import { Observable } from "rxjs";
10
+
11
+ export const protobufPackage = "booking.v1";
12
+
13
+ export interface GetUserBookingsRequest {
14
+ userId: string;
15
+ }
16
+
17
+ export interface GetUserBookingsResponse {
18
+ bookings: BookingItem[];
19
+ }
20
+
21
+ export interface CreateReservationRequest {
22
+ userId: string;
23
+ screeningId: string;
24
+ seats: SeatInput[];
25
+ }
26
+
27
+ export interface CreateReservationResponse {
28
+ orderId: string;
29
+ ticketIds: string[];
30
+ amount: number;
31
+ }
32
+
33
+ export interface SeatInput {
34
+ seatId: string;
35
+ price: number;
36
+ }
37
+
38
+ export interface ConfirmBookingRequest {
39
+ bookingId: string;
40
+ userId: string;
41
+ }
42
+
43
+ export interface ConfirmBookingResponse {
44
+ ok: boolean;
45
+ }
46
+
47
+ export interface CancelBookingRequest {
48
+ bookingId: string;
49
+ userId: string;
50
+ }
51
+
52
+ export interface CancelBookingResponse {
53
+ ok: boolean;
54
+ }
55
+
56
+ export interface ListReservedSeatsRequest {
57
+ hallId: string;
58
+ screeningId: string;
59
+ }
60
+
61
+ export interface ListReservedSeatsResponse {
62
+ reservedSeatIds: string[];
63
+ }
64
+
65
+ export interface BookingSeatInfo {
66
+ id: string;
67
+ row: number;
68
+ number: number;
69
+ }
70
+
71
+ export interface BookingMovieInfo {
72
+ id: string;
73
+ title: string;
74
+ poster: string;
75
+ }
76
+
77
+ export interface BookingTheaterInfo {
78
+ id: string;
79
+ name: string;
80
+ }
81
+
82
+ export interface BookingHallInfo {
83
+ id: string;
84
+ name: string;
85
+ }
86
+
87
+ export interface BookingItem {
88
+ id: string;
89
+ screeningDate: string;
90
+ screeningTime: string;
91
+ movie: BookingMovieInfo | undefined;
92
+ theater: BookingTheaterInfo | undefined;
93
+ hall: BookingHallInfo | undefined;
94
+ seats: BookingSeatInfo[];
95
+ qrCode: string;
96
+ }
97
+
98
+ export const BOOKING_V1_PACKAGE_NAME = "booking.v1";
99
+
100
+ export interface BookingServiceClient {
101
+ getUserBookings(request: GetUserBookingsRequest): Observable<GetUserBookingsResponse>;
102
+
103
+ createReservation(request: CreateReservationRequest): Observable<CreateReservationResponse>;
104
+
105
+ confirmBooking(request: ConfirmBookingRequest): Observable<ConfirmBookingResponse>;
106
+
107
+ cancelBooking(request: CancelBookingRequest): Observable<CancelBookingResponse>;
108
+
109
+ listReservedSeats(request: ListReservedSeatsRequest): Observable<ListReservedSeatsResponse>;
110
+ }
111
+
112
+ export interface BookingServiceController {
113
+ getUserBookings(
114
+ request: GetUserBookingsRequest,
115
+ ): Promise<GetUserBookingsResponse> | Observable<GetUserBookingsResponse> | GetUserBookingsResponse;
116
+
117
+ createReservation(
118
+ request: CreateReservationRequest,
119
+ ): Promise<CreateReservationResponse> | Observable<CreateReservationResponse> | CreateReservationResponse;
120
+
121
+ confirmBooking(
122
+ request: ConfirmBookingRequest,
123
+ ): Promise<ConfirmBookingResponse> | Observable<ConfirmBookingResponse> | ConfirmBookingResponse;
124
+
125
+ cancelBooking(
126
+ request: CancelBookingRequest,
127
+ ): Promise<CancelBookingResponse> | Observable<CancelBookingResponse> | CancelBookingResponse;
128
+
129
+ listReservedSeats(
130
+ request: ListReservedSeatsRequest,
131
+ ): Promise<ListReservedSeatsResponse> | Observable<ListReservedSeatsResponse> | ListReservedSeatsResponse;
132
+ }
133
+
134
+ export function BookingServiceControllerMethods() {
135
+ return function (constructor: Function) {
136
+ const grpcMethods: string[] = [
137
+ "getUserBookings",
138
+ "createReservation",
139
+ "confirmBooking",
140
+ "cancelBooking",
141
+ "listReservedSeats",
142
+ ];
143
+ for (const method of grpcMethods) {
144
+ const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
145
+ GrpcMethod("BookingService", method)(constructor.prototype[method], method, descriptor);
146
+ }
147
+ const grpcStreamMethods: string[] = [];
148
+ for (const method of grpcStreamMethods) {
149
+ const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
150
+ GrpcStreamMethod("BookingService", method)(constructor.prototype[method], method, descriptor);
151
+ }
152
+ };
153
+ }
154
+
155
+ export const BOOKING_SERVICE_NAME = "BookingService";
package/gen/ts/payment.ts CHANGED
@@ -31,12 +31,57 @@ export interface ProcessPaymentEventRequest {
31
31
  providerMethodId: string;
32
32
  cardFirst6: string;
33
33
  cardLast4: string;
34
+ bank: string;
35
+ brand: string;
34
36
  }
35
37
 
36
38
  export interface ProcessPaymentEventResponse {
37
39
  ok: boolean;
38
40
  }
39
41
 
42
+ export interface GetUserPaymentMethodsRequest {
43
+ userId: string;
44
+ }
45
+
46
+ export interface GetUserPaymentMethodsResponse {
47
+ methods: PaymentMethodItem[];
48
+ }
49
+
50
+ export interface CreatePaymentMethodRequest {
51
+ userId: string;
52
+ }
53
+
54
+ export interface CreatePaymentMethodResponse {
55
+ id: string;
56
+ url: string;
57
+ }
58
+
59
+ export interface VerifyPaymentMethodRequest {
60
+ userId: string;
61
+ methodId: string;
62
+ }
63
+
64
+ export interface VerifyPaymentMethodResponse {
65
+ ok: boolean;
66
+ }
67
+
68
+ export interface DeletePaymentMethodRequest {
69
+ userId: string;
70
+ methodId: string;
71
+ }
72
+
73
+ export interface DeletePaymentMethodResponse {
74
+ ok: boolean;
75
+ }
76
+
77
+ export interface PaymentMethodItem {
78
+ id: string;
79
+ bank: string;
80
+ brand: string;
81
+ first6: string;
82
+ last4: string;
83
+ }
84
+
40
85
  export interface SeatInput {
41
86
  seatId: string;
42
87
  price: number;
@@ -48,6 +93,14 @@ export interface PaymentServiceClient {
48
93
  createPayment(request: CreatePaymentRequest): Observable<CreatePaymentResponse>;
49
94
 
50
95
  processPaymentEvent(request: ProcessPaymentEventRequest): Observable<ProcessPaymentEventResponse>;
96
+
97
+ getUserPaymentMethods(request: GetUserPaymentMethodsRequest): Observable<GetUserPaymentMethodsResponse>;
98
+
99
+ createPaymentMethod(request: CreatePaymentMethodRequest): Observable<CreatePaymentMethodResponse>;
100
+
101
+ verifyPaymentMethod(request: VerifyPaymentMethodRequest): Observable<VerifyPaymentMethodResponse>;
102
+
103
+ deletePaymentMethod(request: DeletePaymentMethodRequest): Observable<DeletePaymentMethodResponse>;
51
104
  }
52
105
 
53
106
  export interface PaymentServiceController {
@@ -58,11 +111,34 @@ export interface PaymentServiceController {
58
111
  processPaymentEvent(
59
112
  request: ProcessPaymentEventRequest,
60
113
  ): Promise<ProcessPaymentEventResponse> | Observable<ProcessPaymentEventResponse> | ProcessPaymentEventResponse;
114
+
115
+ getUserPaymentMethods(
116
+ request: GetUserPaymentMethodsRequest,
117
+ ): Promise<GetUserPaymentMethodsResponse> | Observable<GetUserPaymentMethodsResponse> | GetUserPaymentMethodsResponse;
118
+
119
+ createPaymentMethod(
120
+ request: CreatePaymentMethodRequest,
121
+ ): Promise<CreatePaymentMethodResponse> | Observable<CreatePaymentMethodResponse> | CreatePaymentMethodResponse;
122
+
123
+ verifyPaymentMethod(
124
+ request: VerifyPaymentMethodRequest,
125
+ ): Promise<VerifyPaymentMethodResponse> | Observable<VerifyPaymentMethodResponse> | VerifyPaymentMethodResponse;
126
+
127
+ deletePaymentMethod(
128
+ request: DeletePaymentMethodRequest,
129
+ ): Promise<DeletePaymentMethodResponse> | Observable<DeletePaymentMethodResponse> | DeletePaymentMethodResponse;
61
130
  }
62
131
 
63
132
  export function PaymentServiceControllerMethods() {
64
133
  return function (constructor: Function) {
65
- const grpcMethods: string[] = ["createPayment", "processPaymentEvent"];
134
+ const grpcMethods: string[] = [
135
+ "createPayment",
136
+ "processPaymentEvent",
137
+ "getUserPaymentMethods",
138
+ "createPaymentMethod",
139
+ "verifyPaymentMethod",
140
+ "deletePaymentMethod",
141
+ ];
66
142
  for (const method of grpcMethods) {
67
143
  const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
68
144
  GrpcMethod("PaymentService", method)(constructor.prototype[method], method, descriptor);
@@ -0,0 +1,65 @@
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: 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
+ createRefund(request: CreateRefundRequest): Observable<CreateRefundResponse>;
36
+
37
+ processRefundEvent(request: ProcessRefundEventRequest): Observable<ProcessRefundEventResponse>;
38
+ }
39
+
40
+ export interface RefundServiceController {
41
+ createRefund(
42
+ request: CreateRefundRequest,
43
+ ): Promise<CreateRefundResponse> | Observable<CreateRefundResponse> | CreateRefundResponse;
44
+
45
+ processRefundEvent(
46
+ request: ProcessRefundEventRequest,
47
+ ): Promise<ProcessRefundEventResponse> | Observable<ProcessRefundEventResponse> | ProcessRefundEventResponse;
48
+ }
49
+
50
+ export function RefundServiceControllerMethods() {
51
+ return function (constructor: Function) {
52
+ const grpcMethods: string[] = ["createRefund", "processRefundEvent"];
53
+ for (const method of grpcMethods) {
54
+ const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
55
+ GrpcMethod("RefundService", method)(constructor.prototype[method], method, descriptor);
56
+ }
57
+ const grpcStreamMethods: string[] = [];
58
+ for (const method of grpcStreamMethods) {
59
+ const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
60
+ GrpcStreamMethod("RefundService", method)(constructor.prototype[method], method, descriptor);
61
+ }
62
+ };
63
+ }
64
+
65
+ export const REFUND_SERVICE_NAME = "RefundService";
@@ -63,6 +63,7 @@ export interface Movie {
63
63
  slug: string;
64
64
  duration: number;
65
65
  banner: string;
66
+ poster: string;
66
67
  }
67
68
 
68
69
  export interface Theater {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@teacinema/contracts",
3
- "version": "1.4.2",
3
+ "version": "1.5.1",
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,97 @@
1
+ syntax = "proto3";
2
+
3
+ package booking.v1;
4
+
5
+ service BookingService {
6
+ rpc GetUserBookings (GetUserBookingsRequest) returns (GetUserBookingsResponse);
7
+ rpc CreateReservation (CreateReservationRequest) returns (CreateReservationResponse);
8
+ rpc ConfirmBooking (ConfirmBookingRequest) returns (ConfirmBookingResponse);
9
+ rpc CancelBooking (CancelBookingRequest) returns (CancelBookingResponse);
10
+
11
+ rpc ListReservedSeats (ListReservedSeatsRequest) returns (ListReservedSeatsResponse);
12
+ }
13
+
14
+ message GetUserBookingsRequest {
15
+ string user_id = 1;
16
+ }
17
+
18
+ message GetUserBookingsResponse {
19
+ repeated BookingItem bookings = 1;
20
+ }
21
+
22
+ message CreateReservationRequest {
23
+ string user_id = 1;
24
+ string screening_id = 2;
25
+ repeated SeatInput seats = 3;
26
+ }
27
+
28
+ message CreateReservationResponse {
29
+ string order_id = 1;
30
+ repeated string ticket_ids = 2;
31
+ int32 amount = 3;
32
+ }
33
+
34
+ message SeatInput {
35
+ string seat_id = 1;
36
+ int32 price = 2;
37
+ }
38
+
39
+ message ConfirmBookingRequest {
40
+ string booking_id = 1;
41
+ string user_id = 2;
42
+ }
43
+
44
+ message ConfirmBookingResponse {
45
+ bool ok = 1;
46
+ }
47
+
48
+ message CancelBookingRequest {
49
+ string booking_id = 1;
50
+ string user_id = 2;
51
+ }
52
+
53
+ message CancelBookingResponse {
54
+ bool ok = 1;
55
+ }
56
+
57
+ message ListReservedSeatsRequest {
58
+ string hall_id = 1;
59
+ string screening_id = 2;
60
+ }
61
+
62
+ message ListReservedSeatsResponse {
63
+ repeated string reserved_seat_ids = 1;
64
+ }
65
+
66
+ message BookingSeatInfo {
67
+ string id = 1;
68
+ int32 row = 2;
69
+ int32 number = 3;
70
+ }
71
+
72
+ message BookingMovieInfo {
73
+ string id = 1;
74
+ string title = 2;
75
+ string poster = 3;
76
+ }
77
+
78
+ message BookingTheaterInfo {
79
+ string id = 1;
80
+ string name = 2;
81
+ }
82
+
83
+ message BookingHallInfo {
84
+ string id = 1;
85
+ string name = 2;
86
+ }
87
+
88
+ message BookingItem {
89
+ string id = 1;
90
+ string screening_date = 2;
91
+ string screening_time = 3;
92
+ BookingMovieInfo movie = 4;
93
+ BookingTheaterInfo theater = 5;
94
+ BookingHallInfo hall = 6;
95
+ repeated BookingSeatInfo seats = 7;
96
+ string qr_code = 8;
97
+ }
@@ -5,6 +5,11 @@ package payment.v1;
5
5
  service PaymentService {
6
6
  rpc CreatePayment (CreatePaymentRequest) returns (CreatePaymentResponse);
7
7
  rpc ProcessPaymentEvent (ProcessPaymentEventRequest) returns (ProcessPaymentEventResponse);
8
+
9
+ rpc GetUserPaymentMethods (GetUserPaymentMethodsRequest) returns (GetUserPaymentMethodsResponse);
10
+ rpc CreatePaymentMethod (CreatePaymentMethodRequest) returns (CreatePaymentMethodResponse);
11
+ rpc VerifyPaymentMethod (VerifyPaymentMethodRequest) returns (VerifyPaymentMethodResponse);
12
+ rpc DeletePaymentMethod (DeletePaymentMethodRequest) returns (DeletePaymentMethodResponse);
8
13
  }
9
14
 
10
15
  message CreatePaymentRequest {
@@ -28,12 +33,57 @@ message ProcessPaymentEventRequest {
28
33
  string provider_method_id = 6;
29
34
  string card_first6 = 7;
30
35
  string card_last4 = 8;
36
+ string bank = 9;
37
+ string brand = 10;
31
38
  }
32
39
 
33
40
  message ProcessPaymentEventResponse {
34
41
  bool ok = 1;
35
42
  }
36
43
 
44
+ message GetUserPaymentMethodsRequest {
45
+ string user_id = 1;
46
+ }
47
+
48
+ message GetUserPaymentMethodsResponse {
49
+ repeated PaymentMethodItem methods = 1;
50
+ }
51
+
52
+ message CreatePaymentMethodRequest {
53
+ string user_id = 1;
54
+ }
55
+
56
+ message CreatePaymentMethodResponse {
57
+ string id = 1;
58
+ string url = 2;
59
+ }
60
+
61
+ message VerifyPaymentMethodRequest {
62
+ string user_id = 1;
63
+ string method_id = 2;
64
+ }
65
+
66
+ message VerifyPaymentMethodResponse {
67
+ bool ok = 1;
68
+ }
69
+
70
+ message DeletePaymentMethodRequest {
71
+ string user_id = 1;
72
+ string method_id = 2;
73
+ }
74
+
75
+ message DeletePaymentMethodResponse {
76
+ bool ok = 1;
77
+ }
78
+
79
+ message PaymentMethodItem {
80
+ string id = 1;
81
+ string bank = 2;
82
+ string brand = 3;
83
+ string first6 = 4;
84
+ string last4 = 5;
85
+ }
86
+
37
87
  message SeatInput {
38
88
  string seat_id = 1;
39
89
  int32 price = 2;
@@ -0,0 +1,27 @@
1
+ syntax = "proto3";
2
+
3
+ package refund.v1;
4
+
5
+ service RefundService {
6
+ rpc CreateRefund(CreateRefundRequest) returns (CreateRefundResponse);
7
+ rpc ProcessRefundEvent(ProcessRefundEventRequest) returns (ProcessRefundEventResponse);
8
+ }
9
+
10
+ message CreateRefundRequest {
11
+ string booking_id = 1;
12
+ string user_id = 2;
13
+ }
14
+
15
+ message CreateRefundResponse {
16
+ bool ok = 1;
17
+ }
18
+
19
+ message ProcessRefundEventRequest {
20
+ string event = 1;
21
+ string provider_refund_id = 2;
22
+ string status = 3;
23
+ }
24
+
25
+ message ProcessRefundEventResponse {
26
+ bool ok = 1;
27
+ }
@@ -65,6 +65,7 @@ message Movie {
65
65
  string slug = 3;
66
66
  int32 duration = 4;
67
67
  string banner = 5;
68
+ string poster = 6;
68
69
  }
69
70
 
70
71
  message Theater {