@tcinema-pro/contracts 1.4.0 → 1.4.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.
@@ -9,4 +9,5 @@ export declare const PROTO_PATHS: {
9
9
  readonly HALL: string;
10
10
  readonly SEAT: string;
11
11
  readonly SCREENING: string;
12
+ readonly PAYMENT: string;
12
13
  };
@@ -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
  };
package/gen/payment.ts ADDED
@@ -0,0 +1,78 @@
1
+ // Code generated by protoc-gen-ts_proto. DO NOT EDIT.
2
+ // versions:
3
+ // protoc-gen-ts_proto v2.11.2
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
+ paymentMethod?: string | undefined;
17
+ savePaymentMethod: boolean;
18
+ seats: SeatInfo[];
19
+ }
20
+
21
+ export interface SeatInfo {
22
+ seatId: string;
23
+ price: number;
24
+ }
25
+
26
+ export interface CreatePaymentResponse {
27
+ url: string;
28
+ }
29
+
30
+ export interface ProcessPaymentEventRequest {
31
+ event: string;
32
+ paymentId: string;
33
+ bookingId: string;
34
+ userId: string;
35
+ savePaymentMethod: boolean;
36
+ providerPaymentId: string;
37
+ cardFirst6: string;
38
+ cardLast4: string;
39
+ }
40
+
41
+ export interface ProcessPaymentEventResponse {
42
+ ok: boolean;
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tcinema-pro/contracts",
3
- "version": "1.4.0",
3
+ "version": "1.4.1",
4
4
  "description": "Protobuf defs",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",
@@ -0,0 +1,42 @@
1
+ syntax = 'proto3';
2
+
3
+ package payment.v1;
4
+
5
+ import "google/protobuf/timestamp.proto";
6
+
7
+ service PaymentService {
8
+ rpc CreatePayment (CreatePaymentRequest) returns (CreatePaymentResponse);
9
+ rpc ProcessPaymentEvent (ProcessPaymentEventRequest) returns (ProcessPaymentEventResponse);
10
+ }
11
+
12
+ message CreatePaymentRequest {
13
+ string user_id = 1;
14
+ string screening_id = 2;
15
+ optional string payment_method = 3;
16
+ bool save_payment_method = 4;
17
+ repeated SeatInfo seats = 5;
18
+ }
19
+
20
+ message SeatInfo {
21
+ string seat_id = 1;
22
+ int32 price = 2;
23
+ }
24
+
25
+ message CreatePaymentResponse {
26
+ string url = 1;
27
+ }
28
+
29
+ message ProcessPaymentEventRequest {
30
+ string event = 1;
31
+ string payment_id = 2;
32
+ string booking_id = 3;
33
+ string user_id = 4;
34
+ bool save_payment_method = 5;
35
+ string provider_payment_id = 6;
36
+ string card_first6 = 7;
37
+ string card_last4 = 8;
38
+ }
39
+
40
+ message ProcessPaymentEventResponse {
41
+ bool ok = 1;
42
+ }