@airticketss/contracts 1.3.3 → 1.4.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.
@@ -8,4 +8,5 @@ export declare const PROTO_PATHS: {
8
8
  readonly PLANE: string;
9
9
  readonly SEAT: string;
10
10
  readonly PAYMENT: string;
11
+ readonly REFUND: string;
11
12
  };
@@ -12,4 +12,5 @@ exports.PROTO_PATHS = {
12
12
  PLANE: (0, path_1.join)(__dirname, "../../proto/plane.proto"),
13
13
  SEAT: (0, path_1.join)(__dirname, "../../proto/seat.proto"),
14
14
  PAYMENT: (0, path_1.join)(__dirname, "../../proto/payment.proto"),
15
+ REFUND: (0, path_1.join)(__dirname, "../../proto/refund.proto"),
15
16
  };
package/gen/ts/payment.ts CHANGED
@@ -37,6 +37,49 @@ export interface ProcessPaymentEventResponse {
37
37
  ok: boolean;
38
38
  }
39
39
 
40
+ export interface GetUserPaymentMethodsRequest {
41
+ userId: string;
42
+ }
43
+
44
+ export interface GetUserPaymentMethodsResponse {
45
+ methods: PaymentMethodItem[];
46
+ }
47
+
48
+ export interface CreatePaymentMethodRequest {
49
+ userId: string;
50
+ }
51
+
52
+ export interface CreatePaymentMethodResponse {
53
+ id: string;
54
+ url: string;
55
+ }
56
+
57
+ export interface VerifyPaymentMethodRequest {
58
+ userId: string;
59
+ methodId: string;
60
+ }
61
+
62
+ export interface VerifyPaymentMethodResponse {
63
+ ok: boolean;
64
+ }
65
+
66
+ export interface DeletePaymentMethodRequest {
67
+ userId: string;
68
+ methodId: string;
69
+ }
70
+
71
+ export interface DeletePaymentMethodResponse {
72
+ ok: boolean;
73
+ }
74
+
75
+ export interface PaymentMethodItem {
76
+ id: string;
77
+ bank: string;
78
+ brand: string;
79
+ first6: string;
80
+ last4: string;
81
+ }
82
+
40
83
  export interface SeatInput {
41
84
  seatId: string;
42
85
  price: number;
@@ -48,6 +91,14 @@ export interface PaymentServiceClient {
48
91
  createPayment(request: CreatePaymentRequest): Observable<CreatePaymentResponse>;
49
92
 
50
93
  processPaymentEvent(request: ProcessPaymentEventRequest): Observable<ProcessPaymentEventResponse>;
94
+
95
+ getUserPaymentMethods(request: GetUserPaymentMethodsRequest): Observable<GetUserPaymentMethodsResponse>;
96
+
97
+ createPaymentMethod(request: CreatePaymentMethodRequest): Observable<CreatePaymentMethodResponse>;
98
+
99
+ verifyPaymentMethod(request: VerifyPaymentMethodRequest): Observable<VerifyPaymentMethodResponse>;
100
+
101
+ deletePaymentMethod(request: DeletePaymentMethodRequest): Observable<DeletePaymentMethodResponse>;
51
102
  }
52
103
 
53
104
  export interface PaymentServiceController {
@@ -58,11 +109,34 @@ export interface PaymentServiceController {
58
109
  processPaymentEvent(
59
110
  request: ProcessPaymentEventRequest,
60
111
  ): Promise<ProcessPaymentEventResponse> | Observable<ProcessPaymentEventResponse> | ProcessPaymentEventResponse;
112
+
113
+ getUserPaymentMethods(
114
+ request: GetUserPaymentMethodsRequest,
115
+ ): Promise<GetUserPaymentMethodsResponse> | Observable<GetUserPaymentMethodsResponse> | GetUserPaymentMethodsResponse;
116
+
117
+ createPaymentMethod(
118
+ request: CreatePaymentMethodRequest,
119
+ ): Promise<CreatePaymentMethodResponse> | Observable<CreatePaymentMethodResponse> | CreatePaymentMethodResponse;
120
+
121
+ verifyPaymentMethod(
122
+ request: VerifyPaymentMethodRequest,
123
+ ): Promise<VerifyPaymentMethodResponse> | Observable<VerifyPaymentMethodResponse> | VerifyPaymentMethodResponse;
124
+
125
+ deletePaymentMethod(
126
+ request: DeletePaymentMethodRequest,
127
+ ): Promise<DeletePaymentMethodResponse> | Observable<DeletePaymentMethodResponse> | DeletePaymentMethodResponse;
61
128
  }
62
129
 
63
130
  export function PaymentServiceControllerMethods() {
64
131
  return function (constructor: Function) {
65
- const grpcMethods: string[] = ["createPayment", "processPaymentEvent"];
132
+ const grpcMethods: string[] = [
133
+ "createPayment",
134
+ "processPaymentEvent",
135
+ "getUserPaymentMethods",
136
+ "createPaymentMethod",
137
+ "verifyPaymentMethod",
138
+ "deletePaymentMethod",
139
+ ];
66
140
  for (const method of grpcMethods) {
67
141
  const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
68
142
  GrpcMethod("PaymentService", method)(constructor.prototype[method], method, descriptor);
@@ -0,0 +1,67 @@
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: 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
+ Object.defineProperty(constructor.prototype, method, descriptor);
57
+ }
58
+ const grpcStreamMethods: string[] = [];
59
+ for (const method of grpcStreamMethods) {
60
+ const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
61
+ GrpcStreamMethod("RefundService", method)(constructor.prototype[method], method, descriptor);
62
+ Object.defineProperty(constructor.prototype, method, descriptor);
63
+ }
64
+ };
65
+ }
66
+
67
+ export const REFUND_SERVICE_NAME = "RefundService";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@airticketss/contracts",
3
- "version": "1.3.3",
3
+ "version": "1.4.0",
4
4
  "description": "Protobuf definitions and generate TypeScript types",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",
@@ -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 {
@@ -34,6 +39,49 @@ message ProcessPaymentEventResponse {
34
39
  bool ok = 1;
35
40
  }
36
41
 
42
+ message GetUserPaymentMethodsRequest {
43
+ string user_id = 1;
44
+ }
45
+
46
+ message GetUserPaymentMethodsResponse {
47
+ repeated PaymentMethodItem methods = 1;
48
+ }
49
+
50
+ message CreatePaymentMethodRequest {
51
+ string user_id = 1;
52
+ }
53
+
54
+ message CreatePaymentMethodResponse {
55
+ string id = 1;
56
+ string url = 2;
57
+ }
58
+
59
+ message VerifyPaymentMethodRequest {
60
+ string user_id = 1;
61
+ string method_id = 2;
62
+ }
63
+
64
+ message VerifyPaymentMethodResponse {
65
+ bool ok = 1;
66
+ }
67
+
68
+ message DeletePaymentMethodRequest {
69
+ string user_id = 1;
70
+ string method_id = 2;
71
+ }
72
+
73
+ message DeletePaymentMethodResponse {
74
+ bool ok = 1;
75
+ }
76
+
77
+ message PaymentMethodItem {
78
+ string id = 1;
79
+ string bank = 2;
80
+ string brand = 3;
81
+ string first6 = 4;
82
+ string last4 = 5;
83
+ }
84
+
37
85
  message SeatInput {
38
86
  string seat_id = 1;
39
87
  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
+ }