@just-education-org/rpc-contracts 1.18.0 → 1.19.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/generated/ts/booking.d.ts +88 -0
- package/dist/generated/ts/booking.js +34 -0
- package/dist/generated/ts/payment.d.ts +10 -1
- package/dist/generated/ts/payment_method.d.ts +7 -5
- package/dist/generated/ts/screening.d.ts +1 -1
- package/dist/proto/paths.d.ts +1 -0
- package/dist/proto/paths.js +1 -0
- package/package.json +1 -1
- package/proto/booking.proto +97 -0
- package/proto/payment.proto +8 -1
- package/proto/payment_method.proto +7 -5
- package/proto/screening.proto +1 -2
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { Observable } from "rxjs";
|
|
2
|
+
export declare const protobufPackage = "booking.v1";
|
|
3
|
+
export interface GetUserBookingsRequest {
|
|
4
|
+
userId: string;
|
|
5
|
+
}
|
|
6
|
+
export interface GetUserBookingsResponse {
|
|
7
|
+
bookings: BookingItem[];
|
|
8
|
+
}
|
|
9
|
+
export interface CreateReservationRequest {
|
|
10
|
+
userId: string;
|
|
11
|
+
screeningId: string;
|
|
12
|
+
seats: SeatInput[];
|
|
13
|
+
}
|
|
14
|
+
export interface CreateReservationResponse {
|
|
15
|
+
orderId: string;
|
|
16
|
+
ticketIds: string[];
|
|
17
|
+
amount: number;
|
|
18
|
+
}
|
|
19
|
+
export interface ConfirmBookingRequest {
|
|
20
|
+
bookingId: string;
|
|
21
|
+
userId: string;
|
|
22
|
+
}
|
|
23
|
+
export interface ConfirmBookingResponse {
|
|
24
|
+
ok: boolean;
|
|
25
|
+
}
|
|
26
|
+
export interface CancelBookingRequest {
|
|
27
|
+
bookingId: string;
|
|
28
|
+
userId: string;
|
|
29
|
+
}
|
|
30
|
+
export interface CancelBookingResponse {
|
|
31
|
+
ok: boolean;
|
|
32
|
+
}
|
|
33
|
+
export interface ListReservedSeatsRequest {
|
|
34
|
+
hallId: string;
|
|
35
|
+
screeningId: string;
|
|
36
|
+
}
|
|
37
|
+
export interface ListReservedSeatsResponse {
|
|
38
|
+
reservedSeatIds: string[];
|
|
39
|
+
}
|
|
40
|
+
export interface SeatInput {
|
|
41
|
+
seatId: string;
|
|
42
|
+
price: number;
|
|
43
|
+
}
|
|
44
|
+
export interface BookingSeatInfo {
|
|
45
|
+
id: string;
|
|
46
|
+
row: number;
|
|
47
|
+
number: number;
|
|
48
|
+
}
|
|
49
|
+
export interface BookingMovieInfo {
|
|
50
|
+
id: string;
|
|
51
|
+
title: string;
|
|
52
|
+
poster: string;
|
|
53
|
+
}
|
|
54
|
+
export interface BookingTheaterInfo {
|
|
55
|
+
id: string;
|
|
56
|
+
name: string;
|
|
57
|
+
}
|
|
58
|
+
export interface BookingHallInfo {
|
|
59
|
+
id: string;
|
|
60
|
+
name: string;
|
|
61
|
+
}
|
|
62
|
+
export interface BookingItem {
|
|
63
|
+
id: string;
|
|
64
|
+
screeningDate: string;
|
|
65
|
+
screeningTime: string;
|
|
66
|
+
movie: BookingMovieInfo | undefined;
|
|
67
|
+
theater: BookingTheaterInfo | undefined;
|
|
68
|
+
hall: BookingHallInfo | undefined;
|
|
69
|
+
seats: BookingSeatInfo[];
|
|
70
|
+
qrCode: string;
|
|
71
|
+
}
|
|
72
|
+
export declare const BOOKING_V1_PACKAGE_NAME = "booking.v1";
|
|
73
|
+
export interface BookingServiceClient {
|
|
74
|
+
getUserBookings(request: GetUserBookingsRequest): Observable<GetUserBookingsResponse>;
|
|
75
|
+
createReservation(request: CreateReservationRequest): Observable<CreateReservationResponse>;
|
|
76
|
+
confirmBooking(request: ConfirmBookingRequest): Observable<ConfirmBookingResponse>;
|
|
77
|
+
cancelBooking(request: CancelBookingRequest): Observable<CancelBookingResponse>;
|
|
78
|
+
listReservedSeats(request: ListReservedSeatsRequest): Observable<ListReservedSeatsResponse>;
|
|
79
|
+
}
|
|
80
|
+
export interface BookingServiceController {
|
|
81
|
+
getUserBookings(request: GetUserBookingsRequest): Promise<GetUserBookingsResponse> | Observable<GetUserBookingsResponse> | GetUserBookingsResponse;
|
|
82
|
+
createReservation(request: CreateReservationRequest): Promise<CreateReservationResponse> | Observable<CreateReservationResponse> | CreateReservationResponse;
|
|
83
|
+
confirmBooking(request: ConfirmBookingRequest): Promise<ConfirmBookingResponse> | Observable<ConfirmBookingResponse> | ConfirmBookingResponse;
|
|
84
|
+
cancelBooking(request: CancelBookingRequest): Promise<CancelBookingResponse> | Observable<CancelBookingResponse> | CancelBookingResponse;
|
|
85
|
+
listReservedSeats(request: ListReservedSeatsRequest): Promise<ListReservedSeatsResponse> | Observable<ListReservedSeatsResponse> | ListReservedSeatsResponse;
|
|
86
|
+
}
|
|
87
|
+
export declare function BookingServiceControllerMethods(): (constructor: Function) => void;
|
|
88
|
+
export declare const BOOKING_SERVICE_NAME = "BookingService";
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
|
|
3
|
+
// versions:
|
|
4
|
+
// protoc-gen-ts_proto v2.12.0
|
|
5
|
+
// protoc v3.21.12
|
|
6
|
+
// source: booking.proto
|
|
7
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
+
exports.BOOKING_SERVICE_NAME = exports.BOOKING_V1_PACKAGE_NAME = exports.protobufPackage = void 0;
|
|
9
|
+
exports.BookingServiceControllerMethods = BookingServiceControllerMethods;
|
|
10
|
+
/* eslint-disable */
|
|
11
|
+
const microservices_1 = require("@nestjs/microservices");
|
|
12
|
+
exports.protobufPackage = "booking.v1";
|
|
13
|
+
exports.BOOKING_V1_PACKAGE_NAME = "booking.v1";
|
|
14
|
+
function BookingServiceControllerMethods() {
|
|
15
|
+
return function (constructor) {
|
|
16
|
+
const grpcMethods = [
|
|
17
|
+
"getUserBookings",
|
|
18
|
+
"createReservation",
|
|
19
|
+
"confirmBooking",
|
|
20
|
+
"cancelBooking",
|
|
21
|
+
"listReservedSeats",
|
|
22
|
+
];
|
|
23
|
+
for (const method of grpcMethods) {
|
|
24
|
+
const descriptor = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
|
|
25
|
+
(0, microservices_1.GrpcMethod)("BookingService", method)(constructor.prototype[method], method, descriptor);
|
|
26
|
+
}
|
|
27
|
+
const grpcStreamMethods = [];
|
|
28
|
+
for (const method of grpcStreamMethods) {
|
|
29
|
+
const descriptor = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
|
|
30
|
+
(0, microservices_1.GrpcStreamMethod)("BookingService", method)(constructor.prototype[method], method, descriptor);
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
exports.BOOKING_SERVICE_NAME = "BookingService";
|
|
@@ -8,12 +8,16 @@ export interface CreatePaymentRequest {
|
|
|
8
8
|
savePaymentMethod: boolean;
|
|
9
9
|
/** ISO 4217, lowercase (e.g. "usd or uah"), as required by Stripe */
|
|
10
10
|
currency: string;
|
|
11
|
+
bookingId: string;
|
|
11
12
|
}
|
|
12
13
|
export interface CreatePaymentResponse {
|
|
13
14
|
url: string;
|
|
14
15
|
}
|
|
15
16
|
export interface ProcessPaymentEventRequest {
|
|
16
|
-
/**
|
|
17
|
+
/**
|
|
18
|
+
* Our own normalized event type (PAYMENT_SUCCEEDED | PAYMENT_FAILED),
|
|
19
|
+
* not the provider's raw event type — keeps payment-service provider-agnostic
|
|
20
|
+
*/
|
|
17
21
|
event: string;
|
|
18
22
|
paymentId: string;
|
|
19
23
|
bookingId: string;
|
|
@@ -25,6 +29,11 @@ export interface ProcessPaymentEventRequest {
|
|
|
25
29
|
cardLast4?: string | undefined;
|
|
26
30
|
bank?: string | undefined;
|
|
27
31
|
brand?: string | undefined;
|
|
32
|
+
/**
|
|
33
|
+
* Final payment id at the provider (e.g. Stripe PaymentIntent) —
|
|
34
|
+
* written to Payment.providerId, replacing the intermediate id (e.g. Checkout Session)
|
|
35
|
+
*/
|
|
36
|
+
providerIntentId?: string | undefined;
|
|
28
37
|
}
|
|
29
38
|
export interface ProcessPaymentEventResponse {
|
|
30
39
|
ok: boolean;
|
|
@@ -14,11 +14,13 @@ export interface CreatePaymentMethodResponse {
|
|
|
14
14
|
url: string;
|
|
15
15
|
}
|
|
16
16
|
/**
|
|
17
|
-
* -
|
|
18
|
-
* -
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
17
|
+
* - What is verify for?
|
|
18
|
+
* - The provider doesn't send a webhook when a payment method gets linked.
|
|
19
|
+
* We have to check this ourselves: on creation we make a PaymentMethod row
|
|
20
|
+
* in our DB (no card data yet) linked to the user, and once the user
|
|
21
|
+
* finishes linking it on the provider's page, the frontend redirects back
|
|
22
|
+
* with our internal payment method id as a query param — that's when we
|
|
23
|
+
* call VerifyPaymentMethod to look it up and confirm the link.
|
|
22
24
|
*/
|
|
23
25
|
export interface VerifyPaymentMethodRequest {
|
|
24
26
|
userId: string;
|
|
@@ -9,7 +9,6 @@ export interface CreateScreeningRequest {
|
|
|
9
9
|
endAt: Timestamp | undefined;
|
|
10
10
|
}
|
|
11
11
|
export interface CreateScreeningResponse {
|
|
12
|
-
/** Screening screening = 1; */
|
|
13
12
|
ok: boolean;
|
|
14
13
|
}
|
|
15
14
|
export interface GetScreeningsRequest {
|
|
@@ -38,6 +37,7 @@ export interface Movie {
|
|
|
38
37
|
slug: string;
|
|
39
38
|
duration: number;
|
|
40
39
|
banner: string;
|
|
40
|
+
poster: string;
|
|
41
41
|
}
|
|
42
42
|
export interface Screening {
|
|
43
43
|
id: string;
|
package/dist/proto/paths.d.ts
CHANGED
package/dist/proto/paths.js
CHANGED
|
@@ -16,4 +16,5 @@ exports.PROTO_PATHS = {
|
|
|
16
16
|
PAYMENT: (0, path_1.join)(__dirname, "../../proto/payment.proto"),
|
|
17
17
|
PAYMENT_METHOD: (0, path_1.join)(__dirname, "../../proto/payment_method.proto"),
|
|
18
18
|
REFUND: (0, path_1.join)(__dirname, "../../proto/refund.proto"),
|
|
19
|
+
BOOKING: (0, path_1.join)(__dirname, "../../proto/booking.proto"),
|
|
19
20
|
};
|
package/package.json
CHANGED
|
@@ -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 ConfirmBookingRequest {
|
|
35
|
+
string booking_id = 1;
|
|
36
|
+
string user_id = 2;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
message ConfirmBookingResponse {
|
|
40
|
+
bool ok = 1;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
message CancelBookingRequest {
|
|
44
|
+
string booking_id = 1;
|
|
45
|
+
string user_id = 2;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
message CancelBookingResponse {
|
|
49
|
+
bool ok = 1;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
message ListReservedSeatsRequest {
|
|
53
|
+
string hall_id = 1;
|
|
54
|
+
string screening_id = 2;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
message ListReservedSeatsResponse {
|
|
58
|
+
repeated string reserved_seat_ids = 2;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
message SeatInput {
|
|
62
|
+
string seat_id = 1;
|
|
63
|
+
int32 price = 2;
|
|
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
|
+
}
|
package/proto/payment.proto
CHANGED
|
@@ -14,6 +14,7 @@ message CreatePaymentRequest {
|
|
|
14
14
|
optional string payment_method_id = 4;
|
|
15
15
|
bool save_payment_method = 5;
|
|
16
16
|
string currency = 6; // ISO 4217, lowercase (e.g. "usd or uah"), as required by Stripe
|
|
17
|
+
string booking_id = 7;
|
|
17
18
|
}
|
|
18
19
|
|
|
19
20
|
message CreatePaymentResponse {
|
|
@@ -21,7 +22,9 @@ message CreatePaymentResponse {
|
|
|
21
22
|
}
|
|
22
23
|
|
|
23
24
|
message ProcessPaymentEventRequest {
|
|
24
|
-
|
|
25
|
+
// Our own normalized event type (PAYMENT_SUCCEEDED | PAYMENT_FAILED),
|
|
26
|
+
// not the provider's raw event type — keeps payment-service provider-agnostic
|
|
27
|
+
string event = 1;
|
|
25
28
|
string payment_id = 2;
|
|
26
29
|
string booking_id = 3;
|
|
27
30
|
string user_id = 4;
|
|
@@ -33,6 +36,10 @@ message ProcessPaymentEventRequest {
|
|
|
33
36
|
|
|
34
37
|
optional string bank = 9;
|
|
35
38
|
optional string brand = 10;
|
|
39
|
+
|
|
40
|
+
// Final payment id at the provider (e.g. Stripe PaymentIntent) —
|
|
41
|
+
// written to Payment.providerId, replacing the intermediate id (e.g. Checkout Session)
|
|
42
|
+
optional string provider_intent_id = 11;
|
|
36
43
|
}
|
|
37
44
|
|
|
38
45
|
message ProcessPaymentEventResponse {
|
|
@@ -26,11 +26,13 @@ message CreatePaymentMethodResponse {
|
|
|
26
26
|
}
|
|
27
27
|
|
|
28
28
|
message VerifyPaymentMethodRequest {
|
|
29
|
-
// -
|
|
30
|
-
// -
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
//
|
|
29
|
+
// - What is verify for?
|
|
30
|
+
// - The provider doesn't send a webhook when a payment method gets linked.
|
|
31
|
+
// We have to check this ourselves: on creation we make a PaymentMethod row
|
|
32
|
+
// in our DB (no card data yet) linked to the user, and once the user
|
|
33
|
+
// finishes linking it on the provider's page, the frontend redirects back
|
|
34
|
+
// with our internal payment method id as a query param — that's when we
|
|
35
|
+
// call VerifyPaymentMethod to look it up and confirm the link.
|
|
34
36
|
|
|
35
37
|
string user_id = 1;
|
|
36
38
|
string method_id = 2;
|
package/proto/screening.proto
CHANGED
|
@@ -22,9 +22,7 @@ message CreateScreeningRequest {
|
|
|
22
22
|
google.protobuf.Timestamp end_at = 4;
|
|
23
23
|
}
|
|
24
24
|
|
|
25
|
-
|
|
26
25
|
message CreateScreeningResponse {
|
|
27
|
-
// Screening screening = 1;
|
|
28
26
|
bool ok = 1;
|
|
29
27
|
}
|
|
30
28
|
|
|
@@ -60,6 +58,7 @@ message Movie {
|
|
|
60
58
|
string slug = 3;
|
|
61
59
|
int32 duration = 4;
|
|
62
60
|
string banner = 5;
|
|
61
|
+
string poster = 6;
|
|
63
62
|
}
|
|
64
63
|
|
|
65
64
|
message Screening {
|