You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

203 lines
4.4 KiB

9 months ago
syntax = "proto3";
package api;
import "google/api/annotations.proto";
import "google/protobuf/empty.proto";
option go_package = "bkb-payment/api";
// The greeting service definition.
service Greeter {
// Sends a greeting
rpc Ping (google.protobuf.Empty) returns (PingReply) {
option (google.api.http) = {
get: "/ping"
};
}
rpc CountryList (google.protobuf.Empty) returns (CountryReply) {
option (google.api.http) = {
get: "/country/list"
};
}
rpc DistrictCascade (DistrictRequest) returns (DistrictReply) {
option (google.api.http) = {
get: "/district/cascade"
};
}
rpc PayTransactionApp(PayTransRequest) returns (PayTransResponse) {
option (google.api.http) = {
post: "/pay/transaction"
body: "*"
};
}
rpc GetPaymentUrl(PayUrlRequest) returns (PayUrlResponse) {
option (google.api.http) = {
get: "/pay/url"
};
}
rpc PayTransactionAppUrl(PayTransRequest) returns (PayUrlResponse) {
option (google.api.http) = {
post: "/pay/transaction/url"
body: "*"
};
}
rpc SuccessPayback(PaybackRequest) returns (PaybackResp) {
option (google.api.http) = {
post: "/pay/payback"
body: "*"
};
}
rpc PaypalPayback(PaypalWebhook) returns (PaybackResp) {
option (google.api.http) = {
post: "/paypal/callback"
body: "*"
};
}
rpc PayoutsAppUrl(PayoutRequest) returns (PayUrlResponse) {
option (google.api.http) = {
post: "/pay/payouts"
body: "*"
};
}
rpc GetPayTransaction(google.protobuf.Empty) returns (GetPayTransactionResp) {
option (google.api.http) = {
get: "/pay/transaction/outTradeNo"
};
}
rpc CloseBill(CloseBillRequest) returns (PingReply) {
}
// rpc ClosePayTransaction(google.protobuf.Empty) returns (PingReply) {
// option (google.api.http) = {
// post: "/pay/transaction/outTradeNo/close"
// };
// }
}
// The response message containing the greetings
message PingReply {
string message = 1;
}
message Country{
int32 id = 1;
string name = 2;
}
message CountryReply{
repeated Country list = 1;
}
message DistrictRequest {
int32 country = 1;
}
message District {
string label = 1;
string adcode = 2;
int32 parentId = 3;
repeated District children = 4;
}
message DistrictReply{
repeated District list = 1;
}
message PayTransRequest{
string appid = 1;
string mchid = 2;
string out_trade_no = 3;
string attach = 4;
string notify_url = 5;
double amount = 6;
string currency = 7;
string pay_channel = 8;
string return_url = 9;
string cancel_url = 10;
}
message PayTransResponse{
string transaction_id = 1;
string status = 2;
string message = 3;
}
message PayUrlRequest{
string mchid = 1;
string pay_channel = 2;
string transaction_id = 3;
}
message PayUrlResponse{
string pay_channel = 1;
string pay_id = 2;
string pay_return = 3;
string pay_status = 4;
}
message PaybackRequest{
string mchid = 1;
string pay_channel = 2;
string pay_id = 3;
string event_type = 4;
}
message PaybackResp{
string out_trade_no = 1;
string trade_state = 2;
string message = 3;
}
message PayoutRequest{
string appid = 1;
string mchid = 2;
string out_trade_no = 3;
string attach = 4;
string notify_url = 5;
double amount = 6;
string currency = 7;
string pay_channel = 8;
string paypal_name = 9;
}
message GetPayTransOutTradeNoRequest{
string appid = 1;
string mchid = 2;
string out_trade_no = 3;
}
message GetPayTransactionResp{
GetPayTransaction data = 1;
}
message GetPayTransaction{
string appid = 1;
string mchid = 2;
}
message CloseBillRequest{
string transaction_id = 1;
}
message PaypalWebhook{
string id = 1;
string create_time = 2;
string resource_type = 3;
string event_type = 4;
string summary = 5;
PaybackResource resource = 6;
}
message PaybackResource{
string id = 1;
string create_time = 2;
string update_time = 3;
string state = 4;
string status = 5;
repeated PurchaseUnit purchase_units = 6;
BatchHeader batch_header = 7;
}
message PurchaseUnit{
Payment payments = 1;
}
message Payment{
repeated Capture captures = 1;
}
message BatchHeader{
string batch_status = 1;
string payout_batch_id = 2;
SenderBatchHeader sender_batch_header = 3;
}
message SenderBatchHeader{
string sender_batch_id = 1;
}
message Capture{
string id = 1;
string status = 2;
string create_time = 3;
string update_time = 4;
}