77 lines
1.6 KiB
Protocol Buffer
77 lines
1.6 KiB
Protocol Buffer
syntax = "proto3";
|
|
option go_package = "plugins/proto";
|
|
|
|
import "validate/validate.proto";
|
|
|
|
package proto;
|
|
|
|
message Empty {}
|
|
|
|
service Plugin {
|
|
rpc Order (OrderRequest) returns (OrderResponse) {}
|
|
rpc Query (QueryRequest) returns (QueryResponse) {}
|
|
rpc Notify (NotifyRequest) returns (NotifyResponse) {}
|
|
}
|
|
|
|
message Config{
|
|
string appId = 2 [(validate.rules).string = {min_len: 1}];
|
|
string appKey = 3 [(validate.rules).string = {min_len: 1}];
|
|
string baseUri = 4;
|
|
string notifyUrl = 5;
|
|
}
|
|
|
|
enum Status{
|
|
INVALID = 0; // 无效的状态
|
|
SUCCESS = 1; // 成功
|
|
ING = 2; // 处理中
|
|
FAIL = 3; // 失败
|
|
}
|
|
|
|
message Result {
|
|
Status status = 1;
|
|
string order_no = 2;
|
|
string trade_no = 3;
|
|
string message = 4;
|
|
bytes data = 5;
|
|
}
|
|
|
|
message OrderRequest{
|
|
Config config = 1;
|
|
message Order {
|
|
string order_no = 1;
|
|
string account = 2;
|
|
bytes extra = 3; // extra 其他的拓展参数 json 格式
|
|
};
|
|
message Product {
|
|
string product_no = 1;
|
|
float price = 2;
|
|
bytes extra = 3; // extra 其他的拓展参数 json 格式
|
|
}
|
|
Order order = 2;
|
|
Product product = 3;
|
|
}
|
|
message OrderResponse{
|
|
Result result = 1;
|
|
}
|
|
|
|
message QueryRequest{
|
|
Config config = 1;
|
|
message Request {
|
|
string order_no = 1;
|
|
string trade_no = 2;
|
|
bytes extra = 3;
|
|
}
|
|
}
|
|
message QueryResponse{
|
|
Result result = 1;
|
|
}
|
|
|
|
message NotifyRequest{
|
|
Config config = 1;
|
|
bytes queries = 2; // url 地址中的参数 json
|
|
bytes headers = 3; // header 头里面的参数 json
|
|
bytes body = 4; // 通过 form 表单或者 body 提交的数据 json
|
|
}
|
|
message NotifyResponse{
|
|
Result result = 1;
|
|
} |