-
Notifications
You must be signed in to change notification settings - Fork 2
/
pay.proto
331 lines (290 loc) · 7.16 KB
/
pay.proto
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
syntax = "proto3";
package pay;
option go_package="./pay";
// base message
enum PayStatus {
PAY_STATUS_UNKNOWN = 0;
PAY_WAITING = 1;
PAY_SUCCESS = 2;
PAY_REFUND = 3;
PAY_CLOSED = 4;
PAY_FAILURE = 5;
}
enum PayType {
PAY_TYPE_UNKNOWN = 0;
PAY_ORDER = 1;
PAY_RETURN = 2;
}
enum PayChannel {
ChannelUnknown = 0;
WxPub = 1;
WxLite = 2;
WxApp = 3;
WxNative = 4;
AlipayPc = 5;
AlipayWap = 6;
AlipayQr = 7;
AlipayBar = 8;
}
// TODO 给返回消息加上状态码? 暂时没想好怎么用。
enum RetCode {
SUCCESS = 0;
ERROR = 500;
TRADE_UUID_EMPTY = 7000003;
}
message RefundCountResp {
uint64 count = 1;
}
message IDReq {
uint64 id = 1;
}
message OrderCreateReq {
string userIp = 2;
string merchantOrderId = 3;
string subject = 4;
string body = 5;
int32 price = 6;
int64 expireTime = 7;
string notifyBusinessUrl = 8;
}
// refund message
message RefundInfo {
optional uint64 id = 1;
optional int64 created_at = 2;
optional int64 updated_at = 3;
optional uint32 status = 4;
optional string no = 5;
optional string channel_code = 6;
optional uint64 order_id = 7;
optional string order_no = 8;
optional string merchant_order_id = 9;
optional string merchant_refund_id = 10;
optional int32 pay_price = 11;
optional int32 refund_price = 12;
optional string reason = 13;
optional string user_ip = 14;
optional string channel_order_no = 15;
optional string channel_refund_no = 16;
optional int64 success_time = 17;
optional string channel_error_code = 18;
optional string channel_error_msg = 19;
optional string channel_notify_data = 20;
}
message DemoOrderPageReq {
uint64 page = 1;
uint64 page_size = 2;
}
message StringList {
repeated string items = 1;
}
message IDsReq {
repeated uint64 ids = 1;
}
message BaseIDResp {
uint64 id = 1;
string msg = 2;
}
message DemoOrderInfo {
optional uint64 id = 1;
optional int64 created_at = 2;
optional int64 updated_at = 3;
optional string userId = 4;
optional uint64 spuId = 5;
optional string spuName = 6;
optional int32 price = 7;
optional bool pay_status = 8;
optional uint64 pay_orderId = 9;
optional int64 pay_time = 10;
optional string pay_channel_code = 11;
optional uint64 pay_refund_id = 12;
optional int32 refund_price = 13;
optional int64 refund_time = 14;
}
message OrderListResp {
uint64 total = 1;
repeated OrderInfo data = 2;
}
message OrderSubmitResp {
uint32 Status = 1;
optional string DisplayMode = 2;
optional string DisplayContent = 3;
}
message NotifyRefundReq {
string channelCode = 1;
bytes r = 2;
}
message PageInfoReq {
uint64 page = 1;
uint64 page_size = 2;
}
message OrderPageReq {
uint64 page = 1;
uint64 page_size = 2;
optional string channelCode = 4;
optional string merchantOrderId = 5;
optional string channelOrderNo = 6;
optional string no = 7;
optional uint32 status = 8;
repeated int64 createTime = 9;
}
message NoReq {
string no = 1;
}
message OrderSubmitReq {
uint64 Id = 1;
string ChannelCode = 2;
map<string,string> ChannelExtras = 3;
string DisplayMode = 4;
string ReturnUrl = 5;
string UserIP = 6;
}
message UUIDsReq {
repeated string ids = 1;
}
message BaseResp {
string msg = 2;
}
message DemoOrderListResp {
uint64 total = 1;
repeated DemoOrderInfo demoOrderList = 2;
}
message updateDemoRefundPaidReq {
uint64 id = 1;
uint64 payRefundId = 2;
}
message RefundPageReq {
uint64 page = 1;
uint64 page_size = 2;
optional string channelCode = 4;
optional string merchantOrderId = 5;
optional string merchantRefundId = 6;
optional string channelOrderNo = 7;
optional string channelRefundNo = 8;
optional uint32 status = 9;
repeated int64 createTime = 10;
}
// base message
message Empty {}
message UUIDReq {
string id = 1;
}
message PayDemoOrderCreateReq {
string userId = 1;
uint64 spuId = 2;
string userIp = 3;
}
message NotifyOrderReq {
bytes r = 1;
string code = 2;
}
message RefundCreateReq {
string user_ip = 2;
string merchant_order_id = 3;
string merchant_refund_id = 4;
string reason = 5;
int32 price = 6;
}
message BaseUUIDResp {
string id = 1;
string msg = 2;
}
message updateDemoOrderPaidReq {
uint64 id = 1;
uint64 payOrderId = 2;
}
message OrderExtensionInfo {
optional uint64 id = 1;
optional int64 created_at = 2;
optional int64 updated_at = 3;
optional uint32 status = 4;
optional string no = 5;
optional uint64 order_id = 6;
optional string channel_code = 8;
optional string user_ip = 9;
map<string,string> channel_extras = 10;
optional string channel_error_code = 11;
optional string channel_error_msg = 12;
optional string channel_notify_data = 13;
}
message OrderCreateExtensionReq {
uint64 orderID = 1;
string channelCode = 2;
map<string,string> channelExtras = 3;
string no = 4;
uint32 status = 6;
string userIP = 7;
}
message RefundPageResp {
uint64 total = 1;
repeated RefundInfo data = 2;
}
message BaseMsg {
string msg = 1;
}
message RefundDemoOrderReq {
uint64 Id = 2;
string userIp = 3;
}
message OrderInfo {
optional uint64 id = 1;
optional int64 created_at = 2;
optional int64 updated_at = 3;
optional uint32 status = 4;
optional string channel_code = 5;
optional string merchant_order_id = 6;
optional string subject = 7;
optional string body = 8;
optional int32 price = 9;
optional double channel_fee_rate = 10;
optional int32 channel_fee_price = 11;
optional string user_ip = 12;
optional int64 expire_time = 13;
optional int64 success_time = 14;
optional int64 notify_time = 15;
optional uint64 extension_id = 16;
optional string no = 17;
optional int32 refund_price = 18;
optional string channel_user_id = 19;
optional string channel_order_no = 20;
}
service Pay {
// group: base
rpc initDatabase(Empty) returns (BaseResp);
// Demo management
// group: demo
rpc createDemoOrder(PayDemoOrderCreateReq) returns (BaseIDResp);
// group: demo
rpc getDemoOrder(IDReq) returns (DemoOrderInfo);
// group: demo
rpc getListDemoOrder(DemoOrderPageReq) returns (DemoOrderListResp);
// group: demo
rpc updateDemoOrderPaid(updateDemoOrderPaidReq) returns (BaseResp);
// group: demo
rpc refundDemoOrder(RefundDemoOrderReq) returns (BaseResp);
// group: demo
rpc updateDemoRefundPaid(updateDemoRefundPaidReq) returns (BaseResp);
// Order management
// group: order
rpc createOrder(OrderCreateReq) returns (BaseIDResp);
// group: order
rpc getOrder(IDReq) returns (OrderInfo);
// group: order
rpc getOrderPage(OrderPageReq) returns (OrderListResp);
// group: order
rpc createOrderExtension(OrderCreateExtensionReq) returns (BaseIDResp);
// group: order
rpc getOrderExtension(IDReq) returns (OrderExtensionInfo);
// group: order
rpc notifyOrder(NotifyOrderReq) returns (BaseResp);
// group: order
rpc submitPayOrder(OrderSubmitReq) returns (OrderSubmitResp);
// refund management
// group: refund
rpc createRefund(RefundCreateReq) returns (BaseIDResp);
// group: refund
rpc getRefundPage(RefundPageReq) returns (RefundPageResp);
// group: refund
rpc getRefundById(IDReq) returns (RefundInfo);
// group: refund
rpc notifyRefund(NotifyRefundReq) returns (BaseResp);
}