@readytomog/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.
- package/dist/proto/paths.d.ts +1 -0
- package/dist/proto/paths.js +1 -0
- package/gen/payment.ts +137 -0
- package/package.json +1 -1
- package/proto/payment.proto +76 -0
package/dist/proto/paths.d.ts
CHANGED
package/dist/proto/paths.js
CHANGED
|
@@ -6,4 +6,5 @@ exports.PROTO_PATHS = {
|
|
|
6
6
|
AUTH: (0, path_1.join)(__dirname, "../../proto/auth.proto"),
|
|
7
7
|
USER: (0, path_1.join)(__dirname, "../../proto/user.proto"),
|
|
8
8
|
CHAT: (0, path_1.join)(__dirname, "../../proto/chat.proto"),
|
|
9
|
+
PAYMENT: (0, path_1.join)(__dirname, "../../proto/payment.proto"),
|
|
9
10
|
};
|
package/gen/payment.ts
ADDED
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
|
|
2
|
+
// versions:
|
|
3
|
+
// protoc-gen-ts_proto v2.11.8
|
|
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
|
+
import { Empty } from "./google/protobuf/empty";
|
|
11
|
+
|
|
12
|
+
export const protobufPackage = "payment.v3";
|
|
13
|
+
|
|
14
|
+
export interface Transaction {
|
|
15
|
+
id: string;
|
|
16
|
+
status: string;
|
|
17
|
+
paymentProvider: string;
|
|
18
|
+
createdAt: string;
|
|
19
|
+
updatedAt: string;
|
|
20
|
+
billingPeriod: string;
|
|
21
|
+
amount: number;
|
|
22
|
+
userId: string;
|
|
23
|
+
planId: string;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export interface GetHistoryResponse {
|
|
27
|
+
transactions: Transaction[];
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export interface InitTransactionRequest {
|
|
31
|
+
planId: string;
|
|
32
|
+
billingPeriod: string;
|
|
33
|
+
provider: string;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export interface InitTransactionResponse {
|
|
37
|
+
cancelUrl: string;
|
|
38
|
+
successUrl: string;
|
|
39
|
+
url: string;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export interface UpdateAutoRenewalStatusRequest {
|
|
43
|
+
isAutoRenewal: boolean;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export interface UpdateAutoRenewalStatusResponse {
|
|
47
|
+
isAutoRenewal: boolean;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
export interface Plan {
|
|
51
|
+
id: string;
|
|
52
|
+
title: string;
|
|
53
|
+
description: string;
|
|
54
|
+
monthlyPrice: number;
|
|
55
|
+
annualyPrice: number;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
export interface GetPlansResponse {
|
|
59
|
+
plans: Plan[];
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
export interface GetPlanByIdRequest {
|
|
63
|
+
planId: string;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
export interface GetPlanByIdResponse {
|
|
67
|
+
plan: Plan | undefined;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
export interface RefundRequest {
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
export interface RefundResponse {
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
export const PAYMENT_V3_PACKAGE_NAME = "payment.v3";
|
|
77
|
+
|
|
78
|
+
export interface PaymentServiceClient {
|
|
79
|
+
getHistory(request: Empty): Observable<GetHistoryResponse>;
|
|
80
|
+
|
|
81
|
+
initTransaction(request: InitTransactionRequest): Observable<InitTransactionResponse>;
|
|
82
|
+
|
|
83
|
+
updateAutoRenewalStatus(request: UpdateAutoRenewalStatusRequest): Observable<UpdateAutoRenewalStatusResponse>;
|
|
84
|
+
|
|
85
|
+
getPlans(request: Empty): Observable<GetPlansResponse>;
|
|
86
|
+
|
|
87
|
+
getPlanById(request: GetPlanByIdRequest): Observable<GetPlanByIdResponse>;
|
|
88
|
+
|
|
89
|
+
refund(request: RefundRequest): Observable<RefundResponse>;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
export interface PaymentServiceController {
|
|
93
|
+
getHistory(request: Empty): Promise<GetHistoryResponse> | Observable<GetHistoryResponse> | GetHistoryResponse;
|
|
94
|
+
|
|
95
|
+
initTransaction(
|
|
96
|
+
request: InitTransactionRequest,
|
|
97
|
+
): Promise<InitTransactionResponse> | Observable<InitTransactionResponse> | InitTransactionResponse;
|
|
98
|
+
|
|
99
|
+
updateAutoRenewalStatus(
|
|
100
|
+
request: UpdateAutoRenewalStatusRequest,
|
|
101
|
+
):
|
|
102
|
+
| Promise<UpdateAutoRenewalStatusResponse>
|
|
103
|
+
| Observable<UpdateAutoRenewalStatusResponse>
|
|
104
|
+
| UpdateAutoRenewalStatusResponse;
|
|
105
|
+
|
|
106
|
+
getPlans(request: Empty): Promise<GetPlansResponse> | Observable<GetPlansResponse> | GetPlansResponse;
|
|
107
|
+
|
|
108
|
+
getPlanById(
|
|
109
|
+
request: GetPlanByIdRequest,
|
|
110
|
+
): Promise<GetPlanByIdResponse> | Observable<GetPlanByIdResponse> | GetPlanByIdResponse;
|
|
111
|
+
|
|
112
|
+
refund(request: RefundRequest): Promise<RefundResponse> | Observable<RefundResponse> | RefundResponse;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
export function PaymentServiceControllerMethods() {
|
|
116
|
+
return function (constructor: Function) {
|
|
117
|
+
const grpcMethods: string[] = [
|
|
118
|
+
"getHistory",
|
|
119
|
+
"initTransaction",
|
|
120
|
+
"updateAutoRenewalStatus",
|
|
121
|
+
"getPlans",
|
|
122
|
+
"getPlanById",
|
|
123
|
+
"refund",
|
|
124
|
+
];
|
|
125
|
+
for (const method of grpcMethods) {
|
|
126
|
+
const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
|
|
127
|
+
GrpcMethod("PaymentService", method)(constructor.prototype[method], method, descriptor);
|
|
128
|
+
}
|
|
129
|
+
const grpcStreamMethods: string[] = [];
|
|
130
|
+
for (const method of grpcStreamMethods) {
|
|
131
|
+
const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
|
|
132
|
+
GrpcStreamMethod("PaymentService", method)(constructor.prototype[method], method, descriptor);
|
|
133
|
+
}
|
|
134
|
+
};
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
export const PAYMENT_SERVICE_NAME = "PaymentService";
|
package/package.json
CHANGED
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
syntax = "proto3";
|
|
2
|
+
|
|
3
|
+
package payment.v3;
|
|
4
|
+
|
|
5
|
+
import "google/protobuf/empty.proto";
|
|
6
|
+
|
|
7
|
+
service PaymentService {
|
|
8
|
+
rpc GetHistory(google.protobuf.Empty) returns (GetHistoryResponse);
|
|
9
|
+
rpc InitTransaction(InitTransactionRequest) returns (InitTransactionResponse);
|
|
10
|
+
rpc UpdateAutoRenewalStatus(UpdateAutoRenewalStatusRequest) returns (UpdateAutoRenewalStatusResponse);
|
|
11
|
+
rpc GetPlans(google.protobuf.Empty) returns (GetPlansResponse);
|
|
12
|
+
rpc GetPlanById(GetPlanByIdRequest) returns (GetPlanByIdResponse);
|
|
13
|
+
rpc Refund(RefundRequest) returns (RefundResponse);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
message Transaction {
|
|
19
|
+
string id = 1;
|
|
20
|
+
string status =2 ;
|
|
21
|
+
string paymentProvider = 3;
|
|
22
|
+
string createdAt = 4;
|
|
23
|
+
string updatedAt = 5;
|
|
24
|
+
string billingPeriod = 6;
|
|
25
|
+
int32 amount = 7;
|
|
26
|
+
string userId = 8;
|
|
27
|
+
string planId = 9;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
message GetHistoryResponse {
|
|
31
|
+
repeated Transaction transactions = 1;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
message InitTransactionRequest {
|
|
35
|
+
string planId = 1;
|
|
36
|
+
string billingPeriod = 2;
|
|
37
|
+
string provider = 3;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
message InitTransactionResponse {
|
|
41
|
+
string cancel_url = 1;
|
|
42
|
+
string success_url = 2;
|
|
43
|
+
string url = 3;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
message UpdateAutoRenewalStatusRequest {
|
|
47
|
+
bool isAutoRenewal = 1;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
message UpdateAutoRenewalStatusResponse {
|
|
51
|
+
bool isAutoRenewal = 1;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
message Plan {
|
|
55
|
+
string id = 1;
|
|
56
|
+
string title = 2;
|
|
57
|
+
string description = 3;
|
|
58
|
+
int32 monthlyPrice = 4;
|
|
59
|
+
int32 annualyPrice = 5;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
message GetPlansResponse {
|
|
64
|
+
repeated Plan plans =1;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
message GetPlanByIdRequest {
|
|
68
|
+
string planId = 1;
|
|
69
|
+
}
|
|
70
|
+
message GetPlanByIdResponse{
|
|
71
|
+
Plan plan = 1;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
message RefundRequest {}
|
|
75
|
+
|
|
76
|
+
message RefundResponse {}
|