@krutish/contracts 1.0.0 → 1.0.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.
- package/gen/payment.ts +58 -0
- package/package.json +1 -1
- package/proto/payment.proto +30 -0
package/gen/payment.ts
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
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
|
+
order: OrderInput | undefined;
|
|
17
|
+
paymentMethod?: string | undefined;
|
|
18
|
+
savePaymentMethod: boolean;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export interface OrderInput {
|
|
22
|
+
orderId: string;
|
|
23
|
+
userId: string;
|
|
24
|
+
price: number;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export interface CreatePaymentResponse {
|
|
28
|
+
url: string;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export const PAYMENT_V1_PACKAGE_NAME = "payment.v1";
|
|
32
|
+
|
|
33
|
+
export interface PaymentServiceClient {
|
|
34
|
+
createPayment(request: CreatePaymentRequest): Observable<CreatePaymentResponse>;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export interface PaymentServiceController {
|
|
38
|
+
createPayment(
|
|
39
|
+
request: CreatePaymentRequest,
|
|
40
|
+
): Promise<CreatePaymentResponse> | Observable<CreatePaymentResponse> | CreatePaymentResponse;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export function PaymentServiceControllerMethods() {
|
|
44
|
+
return function (constructor: Function) {
|
|
45
|
+
const grpcMethods: string[] = ["createPayment"];
|
|
46
|
+
for (const method of grpcMethods) {
|
|
47
|
+
const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
|
|
48
|
+
GrpcMethod("PaymentService", method)(constructor.prototype[method], method, descriptor);
|
|
49
|
+
}
|
|
50
|
+
const grpcStreamMethods: string[] = [];
|
|
51
|
+
for (const method of grpcStreamMethods) {
|
|
52
|
+
const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
|
|
53
|
+
GrpcStreamMethod("PaymentService", method)(constructor.prototype[method], method, descriptor);
|
|
54
|
+
}
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
export const PAYMENT_SERVICE_NAME = "PaymentService";
|
package/package.json
CHANGED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
syntax = "proto3";
|
|
2
|
+
|
|
3
|
+
package payment.v1;
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
service PaymentService {
|
|
8
|
+
rpc CreatePayment(CreatePaymentRequest) returns (CreatePaymentResponse);
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
message CreatePaymentRequest {
|
|
14
|
+
string user_id = 1;
|
|
15
|
+
string screening_id = 2;
|
|
16
|
+
OrderInput order = 3;
|
|
17
|
+
optional string payment_method = 4;
|
|
18
|
+
bool save_payment_method = 5;
|
|
19
|
+
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
message OrderInput {
|
|
23
|
+
string order_id = 1;
|
|
24
|
+
string user_id = 2;
|
|
25
|
+
int32 price = 3;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
message CreatePaymentResponse {
|
|
29
|
+
string url = 1;
|
|
30
|
+
}
|