68 lines
1.5 KiB
Protocol Buffer
68 lines
1.5 KiB
Protocol Buffer
|
syntax = "proto3";
|
||
|
option go_package = "plugins/proto";
|
||
|
|
||
|
import "proto/status.proto";
|
||
|
|
||
|
package proto;
|
||
|
|
||
|
message Empty {}
|
||
|
|
||
|
service Plugin {
|
||
|
rpc Order (OrderRequest) returns (OrderResponse) {}
|
||
|
rpc Query (QueryRequest) returns (QueryResponse) {}
|
||
|
rpc Notify (NotifyRequest) returns (NotifyResponse) {}
|
||
|
}
|
||
|
|
||
|
message Result {
|
||
|
Status status = 1;
|
||
|
string order_no = 2;
|
||
|
string trade_no = 3;
|
||
|
string message = 4;
|
||
|
bytes data = 5;
|
||
|
bytes extra = 6; // 额外特殊返回参数 json 格式
|
||
|
}
|
||
|
|
||
|
message OrderRequest{
|
||
|
bytes config = 1;
|
||
|
message Order {
|
||
|
string order_no = 1;
|
||
|
string account = 2;
|
||
|
uint32 quantity = 3;
|
||
|
float amount = 4; // 订单金额
|
||
|
bytes extra = 5; // 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{
|
||
|
bytes config = 1;
|
||
|
message Order {
|
||
|
string order_no = 1;
|
||
|
string trade_no = 2;
|
||
|
string account = 3;
|
||
|
bytes extra = 4; // extra 其他的拓展参数 json 格式
|
||
|
}
|
||
|
Order order = 2;
|
||
|
}
|
||
|
message QueryResponse{
|
||
|
Result result = 1;
|
||
|
}
|
||
|
|
||
|
message NotifyRequest{
|
||
|
bytes config = 1;
|
||
|
bytes queries = 2; // url 地址中的参数 json
|
||
|
bytes headers = 3; // header 头里面的参数 json
|
||
|
bytes body = 4; // 通过 form 表单或者 body 提交的数据 json
|
||
|
}
|
||
|
message NotifyResponse{
|
||
|
Result result = 1;
|
||
|
}
|