wash-service-sdk 1.0.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/clients/payment.client.d.ts +18 -0
- package/dist/clients/payment.client.js +145 -0
- package/dist/clients/user.client.d.ts +9 -0
- package/dist/clients/user.client.js +55 -0
- package/dist/generated/auth.d.ts +62 -0
- package/dist/generated/auth.grpc-client.d.ts +28 -0
- package/dist/generated/auth.grpc-client.js +44 -0
- package/dist/generated/auth.js +127 -0
- package/dist/generated/payment.d.ts +575 -0
- package/dist/generated/payment.grpc-client.d.ts +157 -0
- package/dist/generated/payment.grpc-client.js +116 -0
- package/dist/generated/payment.js +1293 -0
- package/dist/generated/user.d.ts +216 -0
- package/dist/generated/user.grpc-client.d.ts +67 -0
- package/dist/generated/user.grpc-client.js +65 -0
- package/dist/generated/user.js +492 -0
- package/dist/index.d.ts +28 -0
- package/dist/index.js +26 -0
- package/package.json +26 -0
- package/proto/auth.proto +19 -0
- package/proto/payment.proto +148 -0
- package/proto/user.proto +57 -0
- package/src/clients/payment.client.ts +233 -0
- package/src/clients/user.client.ts +57 -0
- package/src/generated/auth.grpc-client.ts +38 -0
- package/src/generated/auth.ts +159 -0
- package/src/generated/payment.grpc-client.ts +197 -0
- package/src/generated/payment.ts +1668 -0
- package/src/generated/user.grpc-client.ts +86 -0
- package/src/generated/user.ts +618 -0
- package/src/index.ts +53 -0
- package/tsconfig.json +30 -0
- package/wash-service-sdk-1.0.0.tgz +0 -0
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
syntax = "proto3";
|
|
2
|
+
|
|
3
|
+
package payment;
|
|
4
|
+
|
|
5
|
+
// 서비스 데이터 추가
|
|
6
|
+
message AddServiceRequest {
|
|
7
|
+
string serviceId = 1;
|
|
8
|
+
string name = 2;
|
|
9
|
+
string type = 3;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
// 서비스 데이터 추가
|
|
13
|
+
message AddServiceResponse {
|
|
14
|
+
bool result = 1;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
// 결제 요청 메시지 정의
|
|
18
|
+
message PaymentRequest {
|
|
19
|
+
string userId = 1; // 사용자 ID
|
|
20
|
+
string serviceId = 2; // 사용자 ID
|
|
21
|
+
string name = 3;
|
|
22
|
+
int32 amount = 4; // 결제 금액
|
|
23
|
+
string data = 5; // 결제 데이터
|
|
24
|
+
string type = 6; // 결제 데이터
|
|
25
|
+
string storeId = 7;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
message ConfirmPaymentRequest {
|
|
29
|
+
string orderId = 1;
|
|
30
|
+
string transactionId = 2;
|
|
31
|
+
int32 amount = 3;
|
|
32
|
+
string name = 4;
|
|
33
|
+
string type = 5;
|
|
34
|
+
string storeId = 6;
|
|
35
|
+
string paymentMethod = 7;
|
|
36
|
+
optional string paymentKey = 8;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
message ConfirmPaymentResponse {
|
|
40
|
+
string paymentId = 1; // 거래 ID
|
|
41
|
+
string orderId = 2;
|
|
42
|
+
string name = 3;
|
|
43
|
+
int32 amount = 4; // 결제 금액
|
|
44
|
+
string type = 5; // 결제 데이터
|
|
45
|
+
string status = 6; // 결제 상태 (예: SUCCESS, FAILED)
|
|
46
|
+
string created_at = 7;
|
|
47
|
+
string updated_at = 8;
|
|
48
|
+
optional string paid_at = 9;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
// 결제 요청 메시지 정의
|
|
52
|
+
message PaymentPaymentKeyRequest {
|
|
53
|
+
string userId = 1; // 사용자 ID
|
|
54
|
+
string serviceId = 2; // 사용자 ID
|
|
55
|
+
string name = 3;
|
|
56
|
+
int32 amount = 4; // 결제 금액
|
|
57
|
+
string data = 5; // 결제 데이터
|
|
58
|
+
string type = 6; // 결제 데이터
|
|
59
|
+
string storeId = 7;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
// 결제 응답 메시지 정의
|
|
63
|
+
message PaymentResponse {
|
|
64
|
+
string paymentId = 1; // 거래 ID
|
|
65
|
+
string status = 2; // 결제 상태 (예: SUCCESS, FAILED)
|
|
66
|
+
string message = 3; // 상태 메시지
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
// 결제 요청 메시지 정의
|
|
70
|
+
message CancelRequest {
|
|
71
|
+
string paymentId = 1; // 서비스 ID
|
|
72
|
+
string reason = 2;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
message GetRevenueSubscriptionRequest {
|
|
76
|
+
string storeId = 1;
|
|
77
|
+
int32 startTime = 2;
|
|
78
|
+
int32 endTime = 3;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
// 결제 요청 메시지 정의
|
|
82
|
+
message CancelResponse {
|
|
83
|
+
string serviceId = 1; // 서비스 ID
|
|
84
|
+
string paymentId = 2;
|
|
85
|
+
string message = 3;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
message IsRegisteredCardRequest {
|
|
89
|
+
string userId = 1;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
message IsRegisteredCardResponse {
|
|
93
|
+
bool isRegistered = 1;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
message GetPaymentFailuresRequest {
|
|
97
|
+
string userId = 1;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
message GetPaymentFailuresResponse {
|
|
101
|
+
int32 count = 1;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
message GetRevenueSubscriptionResponse {
|
|
105
|
+
string storeId = 1;
|
|
106
|
+
int32 totalSubscriptionRevenue = 2;
|
|
107
|
+
int32 subscriptionCount = 3;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
message GetDailySubscriptionRevenue{
|
|
111
|
+
string date = 1;
|
|
112
|
+
int32 totalRevenue = 2;
|
|
113
|
+
int32 count = 3;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
message GetDailySubscriptionRevenueResponse {
|
|
117
|
+
repeated GetDailySubscriptionRevenue revenues = 1;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
message GetPaymentV1Request {
|
|
121
|
+
string transactionId = 1;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
message GetPaymentV1Response {
|
|
125
|
+
string transactionId = 1;
|
|
126
|
+
optional string userId = 2;
|
|
127
|
+
int64 amount = 3;
|
|
128
|
+
string status = 4;
|
|
129
|
+
string method = 5;
|
|
130
|
+
string paymentMethod = 6;
|
|
131
|
+
string createdAt = 7;
|
|
132
|
+
string updatedAt = 8;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
// 결제 서비스 정의
|
|
136
|
+
service PaymentService {
|
|
137
|
+
rpc AddService(AddServiceRequest) returns (AddServiceResponse);
|
|
138
|
+
rpc ProcessPayment(PaymentRequest) returns (PaymentResponse);
|
|
139
|
+
rpc RetryPayment(PaymentRequest) returns (PaymentResponse);
|
|
140
|
+
rpc CancelPayment(CancelRequest) returns (PaymentResponse);
|
|
141
|
+
rpc IsRegisteredCard(IsRegisteredCardRequest) returns (IsRegisteredCardResponse);
|
|
142
|
+
rpc GetPaymentFailures(GetPaymentFailuresRequest) returns (GetPaymentFailuresResponse);
|
|
143
|
+
rpc ProcessPaymentBilling(PaymentPaymentKeyRequest) returns (PaymentResponse);
|
|
144
|
+
rpc GetRevenueSubscription(GetRevenueSubscriptionRequest) returns (GetRevenueSubscriptionResponse);
|
|
145
|
+
rpc GetDailyRevenueSubscription(GetRevenueSubscriptionRequest) returns (GetDailySubscriptionRevenueResponse);
|
|
146
|
+
rpc ConfirmPayment(ConfirmPaymentRequest) returns (ConfirmPaymentResponse);
|
|
147
|
+
rpc GetPayment(GetPaymentV1Request) returns (GetPaymentV1Response);
|
|
148
|
+
}
|
package/proto/user.proto
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
syntax = "proto3";
|
|
2
|
+
|
|
3
|
+
package user;
|
|
4
|
+
|
|
5
|
+
message RegisterV1Request {
|
|
6
|
+
string phone = 1;
|
|
7
|
+
repeated int32 termIds = 2;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
// 결제 요청 메시지 정의
|
|
11
|
+
message PutRequest {
|
|
12
|
+
string userId = 1;
|
|
13
|
+
string name = 2;
|
|
14
|
+
string phone = 3;
|
|
15
|
+
bool marketingTerm = 4;
|
|
16
|
+
bool serviceTerm = 5;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
message WithdrawRequest {
|
|
20
|
+
string userId = 1;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
message WithdrawResponse {
|
|
24
|
+
string message = 1;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
// 결제 응답 메시지 정의
|
|
28
|
+
message RegisterResponse {
|
|
29
|
+
string id = 1;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
// 결제 요청 메시지 정의
|
|
33
|
+
message RequestFCMToken {
|
|
34
|
+
string userId = 1;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
// 결제 응답 메시지 정의
|
|
38
|
+
message ResponseFCMToken {
|
|
39
|
+
string token = 1;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
message RegisterV1Response {
|
|
43
|
+
string id = 1;
|
|
44
|
+
string name = 2;
|
|
45
|
+
string phone = 3;
|
|
46
|
+
bool marketingTerm = 4;
|
|
47
|
+
bool serviceTerm = 5;
|
|
48
|
+
string createdAt = 6;
|
|
49
|
+
string updatedAt = 7;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
service UserService {
|
|
53
|
+
rpc PutUser(PutRequest) returns (RegisterResponse);
|
|
54
|
+
rpc WithdrawUser(WithdrawRequest) returns (WithdrawResponse);
|
|
55
|
+
rpc RequestFcmToken(RequestFCMToken) returns (ResponseFCMToken);
|
|
56
|
+
rpc Register(RegisterV1Request) returns (RegisterV1Response);
|
|
57
|
+
}
|
|
@@ -0,0 +1,233 @@
|
|
|
1
|
+
import { PaymentServiceClient } from '../generated/payment.grpc-client';
|
|
2
|
+
import * as grpc from '@grpc/grpc-js';
|
|
3
|
+
import {
|
|
4
|
+
AddServiceRequest,
|
|
5
|
+
AddServiceResponse,
|
|
6
|
+
CancelRequest,
|
|
7
|
+
ConfirmPaymentRequest,
|
|
8
|
+
ConfirmPaymentResponse,
|
|
9
|
+
GetDailySubscriptionRevenueResponse,
|
|
10
|
+
GetPaymentFailuresRequest,
|
|
11
|
+
GetPaymentFailuresResponse,
|
|
12
|
+
GetPaymentV1Request,
|
|
13
|
+
GetPaymentV1Response,
|
|
14
|
+
GetRevenueSubscriptionRequest,
|
|
15
|
+
GetRevenueSubscriptionResponse,
|
|
16
|
+
IsRegisteredCardRequest,
|
|
17
|
+
IsRegisteredCardResponse,
|
|
18
|
+
PaymentPaymentKeyRequest,
|
|
19
|
+
PaymentRequest,
|
|
20
|
+
PaymentResponse,
|
|
21
|
+
} from '../generated/payment';
|
|
22
|
+
|
|
23
|
+
export class PaymentClientWrapper {
|
|
24
|
+
private readonly client: PaymentServiceClient;
|
|
25
|
+
private readonly metadata: grpc.Metadata;
|
|
26
|
+
|
|
27
|
+
constructor(
|
|
28
|
+
address: string,
|
|
29
|
+
credentials: grpc.ChannelCredentials,
|
|
30
|
+
token?: string,
|
|
31
|
+
) {
|
|
32
|
+
this.client = new PaymentServiceClient(address, credentials);
|
|
33
|
+
|
|
34
|
+
// 2. 인증 토큰용 메타데이터 준비
|
|
35
|
+
this.metadata = new grpc.Metadata();
|
|
36
|
+
if (token) {
|
|
37
|
+
this.metadata.set('Authorization', `Bearer ${token}`);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
public async addService(
|
|
42
|
+
request: AddServiceRequest,
|
|
43
|
+
): Promise<AddServiceResponse> {
|
|
44
|
+
return new Promise<AddServiceResponse>((resolve, reject) => {
|
|
45
|
+
this.client.addService(
|
|
46
|
+
request,
|
|
47
|
+
this.metadata,
|
|
48
|
+
(error, response) => {
|
|
49
|
+
if (error) {
|
|
50
|
+
return reject(error);
|
|
51
|
+
}
|
|
52
|
+
resolve(response as AddServiceResponse);
|
|
53
|
+
},
|
|
54
|
+
);
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
public async processPayment(
|
|
59
|
+
request: PaymentRequest,
|
|
60
|
+
): Promise<PaymentResponse> {
|
|
61
|
+
return new Promise<PaymentResponse>((resolve, reject) => {
|
|
62
|
+
this.client.processPayment(
|
|
63
|
+
request,
|
|
64
|
+
this.metadata,
|
|
65
|
+
(error, response) => {
|
|
66
|
+
if (error) {
|
|
67
|
+
return reject(error);
|
|
68
|
+
}
|
|
69
|
+
resolve(response as PaymentResponse);
|
|
70
|
+
},
|
|
71
|
+
);
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
public async confirmPayment(
|
|
76
|
+
request: ConfirmPaymentRequest,
|
|
77
|
+
): Promise<ConfirmPaymentResponse> {
|
|
78
|
+
return new Promise<ConfirmPaymentResponse>((resolve, reject) => {
|
|
79
|
+
this.client.confirmPayment(
|
|
80
|
+
request,
|
|
81
|
+
this.metadata,
|
|
82
|
+
(error, response) => {
|
|
83
|
+
if (error) {
|
|
84
|
+
return reject(error);
|
|
85
|
+
}
|
|
86
|
+
resolve(response as ConfirmPaymentResponse);
|
|
87
|
+
},
|
|
88
|
+
);
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
public async processAutoPayment(
|
|
93
|
+
request: PaymentPaymentKeyRequest,
|
|
94
|
+
): Promise<PaymentResponse> {
|
|
95
|
+
return new Promise<PaymentResponse>((resolve, reject) => {
|
|
96
|
+
this.client.processPaymentBilling(
|
|
97
|
+
request,
|
|
98
|
+
this.metadata,
|
|
99
|
+
(error, response) => {
|
|
100
|
+
if (error) {
|
|
101
|
+
return reject(error);
|
|
102
|
+
}
|
|
103
|
+
resolve(response as PaymentResponse);
|
|
104
|
+
},
|
|
105
|
+
);
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
public async retryPayment(
|
|
110
|
+
request: PaymentRequest,
|
|
111
|
+
): Promise<PaymentResponse> {
|
|
112
|
+
return new Promise<PaymentResponse>((resolve, reject) => {
|
|
113
|
+
this.client.retryPayment(
|
|
114
|
+
request,
|
|
115
|
+
this.metadata,
|
|
116
|
+
(error, response) => {
|
|
117
|
+
if (error) {
|
|
118
|
+
return reject(error);
|
|
119
|
+
}
|
|
120
|
+
resolve(response as PaymentResponse);
|
|
121
|
+
},
|
|
122
|
+
);
|
|
123
|
+
});
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
public async cancelPayment(
|
|
127
|
+
request: CancelRequest,
|
|
128
|
+
): Promise<PaymentResponse> {
|
|
129
|
+
return new Promise<PaymentResponse>((resolve, reject) => {
|
|
130
|
+
this.client.cancelPayment(
|
|
131
|
+
request,
|
|
132
|
+
this.metadata,
|
|
133
|
+
(error, response) => {
|
|
134
|
+
if (error) {
|
|
135
|
+
return reject(error);
|
|
136
|
+
}
|
|
137
|
+
resolve(response as PaymentResponse);
|
|
138
|
+
},
|
|
139
|
+
);
|
|
140
|
+
});
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
public async isRegisteredCard(
|
|
144
|
+
request: IsRegisteredCardRequest,
|
|
145
|
+
): Promise<IsRegisteredCardResponse> {
|
|
146
|
+
return new Promise<IsRegisteredCardResponse>((resolve, reject) => {
|
|
147
|
+
this.client.isRegisteredCard(
|
|
148
|
+
request,
|
|
149
|
+
this.metadata,
|
|
150
|
+
(error, response) => {
|
|
151
|
+
if (error) {
|
|
152
|
+
return reject(error);
|
|
153
|
+
}
|
|
154
|
+
resolve(response as IsRegisteredCardResponse);
|
|
155
|
+
},
|
|
156
|
+
);
|
|
157
|
+
});
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
public async getPaymentFailure(
|
|
161
|
+
request: GetPaymentFailuresRequest,
|
|
162
|
+
): Promise<GetPaymentFailuresResponse> {
|
|
163
|
+
return new Promise<GetPaymentFailuresResponse>((resolve, reject) => {
|
|
164
|
+
this.client.getPaymentFailures(
|
|
165
|
+
request,
|
|
166
|
+
this.metadata,
|
|
167
|
+
(error, response) => {
|
|
168
|
+
if (error) {
|
|
169
|
+
return reject(error);
|
|
170
|
+
}
|
|
171
|
+
resolve(response as GetPaymentFailuresResponse);
|
|
172
|
+
},
|
|
173
|
+
);
|
|
174
|
+
});
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
public async getRevenueSubscription(
|
|
178
|
+
request: GetRevenueSubscriptionRequest,
|
|
179
|
+
): Promise<GetRevenueSubscriptionResponse> {
|
|
180
|
+
return new Promise<GetRevenueSubscriptionResponse>(
|
|
181
|
+
(resolve, reject) => {
|
|
182
|
+
this.client.getRevenueSubscription(
|
|
183
|
+
request,
|
|
184
|
+
this.metadata,
|
|
185
|
+
(error, response) => {
|
|
186
|
+
if (error) {
|
|
187
|
+
return reject(error);
|
|
188
|
+
}
|
|
189
|
+
resolve(response as GetRevenueSubscriptionResponse);
|
|
190
|
+
},
|
|
191
|
+
);
|
|
192
|
+
},
|
|
193
|
+
);
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
public getDailyRevenueSubscription(
|
|
197
|
+
request: GetRevenueSubscriptionRequest,
|
|
198
|
+
): Promise<GetDailySubscriptionRevenueResponse> {
|
|
199
|
+
return new Promise<GetDailySubscriptionRevenueResponse>(
|
|
200
|
+
(resolve, reject) => {
|
|
201
|
+
this.client.getDailyRevenueSubscription(
|
|
202
|
+
request,
|
|
203
|
+
this.metadata,
|
|
204
|
+
(error, response) => {
|
|
205
|
+
if (error) {
|
|
206
|
+
return reject(error);
|
|
207
|
+
}
|
|
208
|
+
resolve(
|
|
209
|
+
response as GetDailySubscriptionRevenueResponse,
|
|
210
|
+
);
|
|
211
|
+
},
|
|
212
|
+
);
|
|
213
|
+
},
|
|
214
|
+
);
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
public getPayment(
|
|
218
|
+
request: GetPaymentV1Request,
|
|
219
|
+
): Promise<GetPaymentV1Response> {
|
|
220
|
+
return new Promise<GetPaymentV1Response>((resolve, reject) => {
|
|
221
|
+
this.client.getPayment(
|
|
222
|
+
request,
|
|
223
|
+
this.metadata,
|
|
224
|
+
(error, response) => {
|
|
225
|
+
if (error) {
|
|
226
|
+
return reject(error);
|
|
227
|
+
}
|
|
228
|
+
resolve(response as GetPaymentV1Response);
|
|
229
|
+
},
|
|
230
|
+
);
|
|
231
|
+
});
|
|
232
|
+
}
|
|
233
|
+
}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import * as grpc from '@grpc/grpc-js';
|
|
2
|
+
import { UserServiceClient } from '../generated/user.grpc-client';
|
|
3
|
+
import {
|
|
4
|
+
type RegisterV1Request,
|
|
5
|
+
type RegisterV1Response,
|
|
6
|
+
RequestFCMToken,
|
|
7
|
+
ResponseFCMToken,
|
|
8
|
+
} from '../generated/user';
|
|
9
|
+
|
|
10
|
+
export class UserClientWrapper {
|
|
11
|
+
private readonly client: UserServiceClient;
|
|
12
|
+
private readonly metadata: grpc.Metadata;
|
|
13
|
+
|
|
14
|
+
constructor(
|
|
15
|
+
address: string,
|
|
16
|
+
credentials: grpc.ChannelCredentials,
|
|
17
|
+
token?: string,
|
|
18
|
+
) {
|
|
19
|
+
this.client = new UserServiceClient(address, credentials);
|
|
20
|
+
|
|
21
|
+
// 2. 인증 토큰용 메타데이터 준비
|
|
22
|
+
this.metadata = new grpc.Metadata();
|
|
23
|
+
if (token) {
|
|
24
|
+
this.metadata.set('Authorization', `Bearer ${token}`);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
public async getFcmToken(
|
|
29
|
+
request: RequestFCMToken,
|
|
30
|
+
): Promise<ResponseFCMToken> {
|
|
31
|
+
return new Promise<ResponseFCMToken>((resolve, reject) => {
|
|
32
|
+
this.client.requestFcmToken(
|
|
33
|
+
request,
|
|
34
|
+
this.metadata,
|
|
35
|
+
(error, response) => {
|
|
36
|
+
if (error) {
|
|
37
|
+
return reject(error);
|
|
38
|
+
}
|
|
39
|
+
resolve(response as ResponseFCMToken);
|
|
40
|
+
},
|
|
41
|
+
);
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
public async signUp(
|
|
46
|
+
request: RegisterV1Request,
|
|
47
|
+
): Promise<RegisterV1Response> {
|
|
48
|
+
return new Promise<RegisterV1Response>((resolve, reject) => {
|
|
49
|
+
this.client.register(request, this.metadata, (error, response) => {
|
|
50
|
+
if (error) {
|
|
51
|
+
return reject(error);
|
|
52
|
+
}
|
|
53
|
+
resolve(response as RegisterV1Response);
|
|
54
|
+
});
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
// @generated by protobuf-ts 2.11.1 with parameter client_grpc1
|
|
2
|
+
// @generated from protobuf file "auth.proto" (package "auth", syntax proto3)
|
|
3
|
+
// tslint:disable
|
|
4
|
+
import { AuthService } from "./auth";
|
|
5
|
+
import type { BinaryWriteOptions } from "@protobuf-ts/runtime";
|
|
6
|
+
import type { BinaryReadOptions } from "@protobuf-ts/runtime";
|
|
7
|
+
import type { AuthResponse } from "./auth";
|
|
8
|
+
import type { AuthRequest } from "./auth";
|
|
9
|
+
import * as grpc from "@grpc/grpc-js";
|
|
10
|
+
/**
|
|
11
|
+
* @generated from protobuf service auth.AuthService
|
|
12
|
+
*/
|
|
13
|
+
export interface IAuthServiceClient {
|
|
14
|
+
/**
|
|
15
|
+
* @generated from protobuf rpc: ValidToken
|
|
16
|
+
*/
|
|
17
|
+
validToken(input: AuthRequest, metadata: grpc.Metadata, options: grpc.CallOptions, callback: (err: grpc.ServiceError | null, value?: AuthResponse) => void): grpc.ClientUnaryCall;
|
|
18
|
+
validToken(input: AuthRequest, metadata: grpc.Metadata, callback: (err: grpc.ServiceError | null, value?: AuthResponse) => void): grpc.ClientUnaryCall;
|
|
19
|
+
validToken(input: AuthRequest, options: grpc.CallOptions, callback: (err: grpc.ServiceError | null, value?: AuthResponse) => void): grpc.ClientUnaryCall;
|
|
20
|
+
validToken(input: AuthRequest, callback: (err: grpc.ServiceError | null, value?: AuthResponse) => void): grpc.ClientUnaryCall;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* @generated from protobuf service auth.AuthService
|
|
24
|
+
*/
|
|
25
|
+
export class AuthServiceClient extends grpc.Client implements IAuthServiceClient {
|
|
26
|
+
private readonly _binaryOptions: Partial<BinaryReadOptions & BinaryWriteOptions>;
|
|
27
|
+
constructor(address: string, credentials: grpc.ChannelCredentials, options: grpc.ClientOptions = {}, binaryOptions: Partial<BinaryReadOptions & BinaryWriteOptions> = {}) {
|
|
28
|
+
super(address, credentials, options);
|
|
29
|
+
this._binaryOptions = binaryOptions;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* @generated from protobuf rpc: ValidToken
|
|
33
|
+
*/
|
|
34
|
+
validToken(input: AuthRequest, metadata: grpc.Metadata | grpc.CallOptions | ((err: grpc.ServiceError | null, value?: AuthResponse) => void), options?: grpc.CallOptions | ((err: grpc.ServiceError | null, value?: AuthResponse) => void), callback?: ((err: grpc.ServiceError | null, value?: AuthResponse) => void)): grpc.ClientUnaryCall {
|
|
35
|
+
const method = AuthService.methods[0];
|
|
36
|
+
return this.makeUnaryRequest<AuthRequest, AuthResponse>(`/${AuthService.typeName}/${method.name}`, (value: AuthRequest): Buffer => Buffer.from(method.I.toBinary(value, this._binaryOptions)), (value: Buffer): AuthResponse => method.O.fromBinary(value, this._binaryOptions), input, (metadata as any), (options as any), (callback as any));
|
|
37
|
+
}
|
|
38
|
+
}
|
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
// @generated by protobuf-ts 2.11.1 with parameter client_grpc1
|
|
2
|
+
// @generated from protobuf file "auth.proto" (package "auth", syntax proto3)
|
|
3
|
+
// tslint:disable
|
|
4
|
+
import { ServiceType } from "@protobuf-ts/runtime-rpc";
|
|
5
|
+
import type { BinaryWriteOptions } from "@protobuf-ts/runtime";
|
|
6
|
+
import type { IBinaryWriter } from "@protobuf-ts/runtime";
|
|
7
|
+
import { WireType } from "@protobuf-ts/runtime";
|
|
8
|
+
import type { BinaryReadOptions } from "@protobuf-ts/runtime";
|
|
9
|
+
import type { IBinaryReader } from "@protobuf-ts/runtime";
|
|
10
|
+
import { UnknownFieldHandler } from "@protobuf-ts/runtime";
|
|
11
|
+
import type { PartialMessage } from "@protobuf-ts/runtime";
|
|
12
|
+
import { reflectionMergePartial } from "@protobuf-ts/runtime";
|
|
13
|
+
import { MessageType } from "@protobuf-ts/runtime";
|
|
14
|
+
/**
|
|
15
|
+
* 결제 요청 메시지 정의
|
|
16
|
+
*
|
|
17
|
+
* @generated from protobuf message auth.AuthRequest
|
|
18
|
+
*/
|
|
19
|
+
export interface AuthRequest {
|
|
20
|
+
/**
|
|
21
|
+
* @generated from protobuf field: string token = 1
|
|
22
|
+
*/
|
|
23
|
+
token: string;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* 결제 응답 메시지 정의
|
|
27
|
+
*
|
|
28
|
+
* @generated from protobuf message auth.AuthResponse
|
|
29
|
+
*/
|
|
30
|
+
export interface AuthResponse {
|
|
31
|
+
/**
|
|
32
|
+
* @generated from protobuf field: string id = 1
|
|
33
|
+
*/
|
|
34
|
+
id: string;
|
|
35
|
+
/**
|
|
36
|
+
* @generated from protobuf field: string service = 2
|
|
37
|
+
*/
|
|
38
|
+
service: string; // 거래 ID
|
|
39
|
+
/**
|
|
40
|
+
* @generated from protobuf field: string type = 3
|
|
41
|
+
*/
|
|
42
|
+
type: string; // 거래 ID
|
|
43
|
+
}
|
|
44
|
+
// @generated message type with reflection information, may provide speed optimized methods
|
|
45
|
+
class AuthRequest$Type extends MessageType<AuthRequest> {
|
|
46
|
+
constructor() {
|
|
47
|
+
super("auth.AuthRequest", [
|
|
48
|
+
{ no: 1, name: "token", kind: "scalar", T: 9 /*ScalarType.STRING*/ }
|
|
49
|
+
]);
|
|
50
|
+
}
|
|
51
|
+
create(value?: PartialMessage<AuthRequest>): AuthRequest {
|
|
52
|
+
const message = globalThis.Object.create((this.messagePrototype!));
|
|
53
|
+
message.token = "";
|
|
54
|
+
if (value !== undefined)
|
|
55
|
+
reflectionMergePartial<AuthRequest>(this, message, value);
|
|
56
|
+
return message;
|
|
57
|
+
}
|
|
58
|
+
internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: AuthRequest): AuthRequest {
|
|
59
|
+
let message = target ?? this.create(), end = reader.pos + length;
|
|
60
|
+
while (reader.pos < end) {
|
|
61
|
+
let [fieldNo, wireType] = reader.tag();
|
|
62
|
+
switch (fieldNo) {
|
|
63
|
+
case /* string token */ 1:
|
|
64
|
+
message.token = reader.string();
|
|
65
|
+
break;
|
|
66
|
+
default:
|
|
67
|
+
let u = options.readUnknownField;
|
|
68
|
+
if (u === "throw")
|
|
69
|
+
throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`);
|
|
70
|
+
let d = reader.skip(wireType);
|
|
71
|
+
if (u !== false)
|
|
72
|
+
(u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
return message;
|
|
76
|
+
}
|
|
77
|
+
internalBinaryWrite(message: AuthRequest, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter {
|
|
78
|
+
/* string token = 1; */
|
|
79
|
+
if (message.token !== "")
|
|
80
|
+
writer.tag(1, WireType.LengthDelimited).string(message.token);
|
|
81
|
+
let u = options.writeUnknownFields;
|
|
82
|
+
if (u !== false)
|
|
83
|
+
(u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
|
|
84
|
+
return writer;
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* @generated MessageType for protobuf message auth.AuthRequest
|
|
89
|
+
*/
|
|
90
|
+
export const AuthRequest = new AuthRequest$Type();
|
|
91
|
+
// @generated message type with reflection information, may provide speed optimized methods
|
|
92
|
+
class AuthResponse$Type extends MessageType<AuthResponse> {
|
|
93
|
+
constructor() {
|
|
94
|
+
super("auth.AuthResponse", [
|
|
95
|
+
{ no: 1, name: "id", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
|
|
96
|
+
{ no: 2, name: "service", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
|
|
97
|
+
{ no: 3, name: "type", kind: "scalar", T: 9 /*ScalarType.STRING*/ }
|
|
98
|
+
]);
|
|
99
|
+
}
|
|
100
|
+
create(value?: PartialMessage<AuthResponse>): AuthResponse {
|
|
101
|
+
const message = globalThis.Object.create((this.messagePrototype!));
|
|
102
|
+
message.id = "";
|
|
103
|
+
message.service = "";
|
|
104
|
+
message.type = "";
|
|
105
|
+
if (value !== undefined)
|
|
106
|
+
reflectionMergePartial<AuthResponse>(this, message, value);
|
|
107
|
+
return message;
|
|
108
|
+
}
|
|
109
|
+
internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: AuthResponse): AuthResponse {
|
|
110
|
+
let message = target ?? this.create(), end = reader.pos + length;
|
|
111
|
+
while (reader.pos < end) {
|
|
112
|
+
let [fieldNo, wireType] = reader.tag();
|
|
113
|
+
switch (fieldNo) {
|
|
114
|
+
case /* string id */ 1:
|
|
115
|
+
message.id = reader.string();
|
|
116
|
+
break;
|
|
117
|
+
case /* string service */ 2:
|
|
118
|
+
message.service = reader.string();
|
|
119
|
+
break;
|
|
120
|
+
case /* string type */ 3:
|
|
121
|
+
message.type = reader.string();
|
|
122
|
+
break;
|
|
123
|
+
default:
|
|
124
|
+
let u = options.readUnknownField;
|
|
125
|
+
if (u === "throw")
|
|
126
|
+
throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`);
|
|
127
|
+
let d = reader.skip(wireType);
|
|
128
|
+
if (u !== false)
|
|
129
|
+
(u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
return message;
|
|
133
|
+
}
|
|
134
|
+
internalBinaryWrite(message: AuthResponse, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter {
|
|
135
|
+
/* string id = 1; */
|
|
136
|
+
if (message.id !== "")
|
|
137
|
+
writer.tag(1, WireType.LengthDelimited).string(message.id);
|
|
138
|
+
/* string service = 2; */
|
|
139
|
+
if (message.service !== "")
|
|
140
|
+
writer.tag(2, WireType.LengthDelimited).string(message.service);
|
|
141
|
+
/* string type = 3; */
|
|
142
|
+
if (message.type !== "")
|
|
143
|
+
writer.tag(3, WireType.LengthDelimited).string(message.type);
|
|
144
|
+
let u = options.writeUnknownFields;
|
|
145
|
+
if (u !== false)
|
|
146
|
+
(u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
|
|
147
|
+
return writer;
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
/**
|
|
151
|
+
* @generated MessageType for protobuf message auth.AuthResponse
|
|
152
|
+
*/
|
|
153
|
+
export const AuthResponse = new AuthResponse$Type();
|
|
154
|
+
/**
|
|
155
|
+
* @generated ServiceType for protobuf service auth.AuthService
|
|
156
|
+
*/
|
|
157
|
+
export const AuthService = new ServiceType("auth.AuthService", [
|
|
158
|
+
{ name: "ValidToken", options: {}, I: AuthRequest, O: AuthResponse }
|
|
159
|
+
]);
|