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.
197 lines
11 KiB
197 lines
11 KiB
syntax = "proto3";
|
|
option go_package = ".;pb";
|
|
import "db.proto";
|
|
import "pay/pay_db.proto";
|
|
|
|
|
|
//读取商品列表
|
|
message PayGetGoodssReq{
|
|
}
|
|
|
|
message PayGetGoodssResp{
|
|
repeated DBGoods goodss = 1;
|
|
}
|
|
|
|
//读取用户订单信息
|
|
message PayGetOrderListReq{
|
|
int32 page = 1; //@go_tags(`json:"page"`) 页码(从1开始)
|
|
int32 size = 2; //@go_tags(`json:"size"`) 每页数量
|
|
}
|
|
|
|
message PayGetOrderListResp{
|
|
repeated DBPayOrder orderss = 1;
|
|
int64 total = 2; //@go_tags(`json:"total"`) 总数
|
|
}
|
|
|
|
|
|
//支付相关接口----------------------------------------------------------------
|
|
//创建支付订单
|
|
message PayCreatePayOrderReq {
|
|
string product_id = 1; //@go_tags(`json:"product_id" binding:"required"`) 商品ID
|
|
string product_name = 2; //@go_tags(`json:"product_name" binding:"required"`) 商品名称
|
|
int64 amount = 4; //@go_tags(`json:"amount" binding:"required,min=1"`) 订单金额(分)
|
|
PaymentMethod payment_method = 5; //@go_tags(`json:"payment_method" binding:"required"`) 支付方式
|
|
string client_ip = 6; //@go_tags(`json:"client_ip"`) 客户端IP
|
|
string extra_data = 7; //@go_tags(`json:"extra_data"`) 扩展数据
|
|
string notify_url = 8; //@go_tags(`json:"notify_url" binding:"required,url"`) 异步通知地址(支付结果回调)
|
|
string return_url = 9; //@go_tags(`json:"return_url" binding:"required,url"`) 返回地址(支付成功后跳转)
|
|
string cancel_url = 10; //@go_tags(`json:"cancel_url" binding:"required,url"`) 取消地址(支付失败后跳转)
|
|
}
|
|
|
|
message PayCreatePayOrderResp {
|
|
string orderid = 1; //@go_tags(`json:"order_id"`) 订单ID
|
|
string product_id = 2; //@go_tags(`json:"product_id" binding:"required"`) 商品ID
|
|
string product_name = 3; //@go_tags(`json:"product_name" binding:"required"`) 商品名称
|
|
AppPayParams pay_params = 5; //@go_tags(`json:"pay_params"`) 支付参数
|
|
string alipay_pay_params = 6; //@go_tags(`json:"alipay_pay_params"`) 支付宝支付参数
|
|
string paypal_pay_params = 7; //@go_tags(`json:"paypal_pay_params"`) PayPal 支付参数
|
|
}
|
|
|
|
//查询订单星系
|
|
message PayAskOrCancelReq{
|
|
string orderid = 1; //@go_tags(`json:"order_id"`) 订单ID
|
|
// 以下字段用于 Apple/Google 主动校验(客户端发起查询时一并传入)
|
|
string apple_receipt_data = 2; //@go_tags(`json:"apple_receipt_data"`) 苹果收据数据或交易ID
|
|
bool apple_use_transaction_id = 3; //@go_tags(`json:"apple_use_transaction_id"`) 是否按交易ID校验
|
|
string google_package_name = 5; //@go_tags(`json:"google_package_name"`) 谷歌包名
|
|
string google_product_id = 6; //@go_tags(`json:"google_product_id"`) 谷歌商品/订阅ID
|
|
string google_purchase_token = 7; //@go_tags(`json:"google_purchase_token"`) 谷歌购买Token
|
|
bool google_is_subscription = 8; //@go_tags(`json:"google_is_subscription"`) 是否订阅类型
|
|
}
|
|
|
|
message PayPayOrderAskResp{
|
|
DBPayOrder order = 1; //@go_tags(`json:"order"`) 订单ID
|
|
DBUser user = 2; //@go_tags(`json:"user"`) 用户信息
|
|
}
|
|
|
|
message PayWeChatNotifyReq {
|
|
string id = 1; // 通知ID(微信生成的唯一标识)
|
|
string create_time = 2; // 通知创建时间(格式:yyyy-MM-dd'T'HH:mm:ss+TIMEZONE)
|
|
string resource_type = 3; // 通知类型(固定为"transaction")
|
|
string event_type = 4; // 事件类型(如"TRANSACTION.SUCCESS")
|
|
string summary = 5; // 通知摘要(如"支付成功")
|
|
Resource resource = 6; // 加密的核心资源数据
|
|
}
|
|
|
|
message PayWeChatNotifyResp {
|
|
|
|
}
|
|
|
|
// 加密资源结构(包含需解密的核心交易数据)
|
|
message Resource {
|
|
string algorithm = 1; // 加密算法(固定为"AEAD_AES_256_GCM")
|
|
string ciphertext = 2; // 加密后的交易数据(base64编码)
|
|
string associated_data = 3; // 附加数据(解密时使用)
|
|
string nonce = 4; // 随机串(解密时使用)
|
|
}
|
|
|
|
// 解密后的核心交易数据(对应 ciphertext 解密结果)
|
|
message WxPayTransaction {
|
|
// 订单基础信息
|
|
string out_trade_no = 1; // 商户订单号(系统生成的订单ID)
|
|
string transaction_id = 2; // 微信支付订单号(微信生成)
|
|
string mchid = 3; // 商户号
|
|
string appid = 4; // 应用ID
|
|
string trade_type = 5; // 交易类型(App支付为"APP")
|
|
string trade_state = 6; // 支付状态(核心字段,如"SUCCESS")
|
|
string trade_state_desc = 7; // 支付状态描述
|
|
|
|
// 金额信息
|
|
Amount amount = 8; // 金额详情
|
|
|
|
// 支付者信息
|
|
Payer payer = 9; // 支付者信息
|
|
|
|
// 时间信息
|
|
string success_time = 10; // 支付成功时间(仅支付成功时存在)
|
|
string create_time = 11; // 订单创建时间
|
|
string close_time = 12; // 订单关闭时间(仅关闭时存在)
|
|
|
|
// 附加信息
|
|
string attach = 13; // 附加数据(下单时传入)
|
|
string notify_url = 14; // 回调通知地址
|
|
string notify_time = 15; // 回调通知时间
|
|
string notify_id = 16; // 回调通知ID
|
|
}
|
|
|
|
// 金额详情
|
|
message Amount {
|
|
int64 total = 1; // 订单总金额(分)
|
|
int64 payer_total = 2; // 支付金额(用户实际支付)
|
|
string currency = 3; // 货币类型(默认"CNY")
|
|
string payer_currency = 4; // 用户支付的货币类型
|
|
}
|
|
|
|
// 支付者信息
|
|
message Payer {
|
|
string openid = 1; // 用户唯一标识(App支付可能为空)
|
|
}
|
|
|
|
// 支付宝异步通知参数
|
|
message PayAlipayNotifyReq {
|
|
string app_id = 1; //@go_tags(`json:"app_id"`) 支付宝分配的appid
|
|
string auth_app_id = 2; //@go_tags(`json:"auth_app_id"`) 授权方的appid(若无则与app_id一致)
|
|
string buyer_id = 3; //@go_tags(`json:"buyer_id"`) 买家支付宝用户ID
|
|
string buyer_logon_id = 4; //@go_tags(`json:"buyer_logon_id"`) 买家支付宝账号(脱敏)
|
|
string buyer_pay_amount = 5; //@go_tags(`json:"buyer_pay_amount"`) 买家实付金额
|
|
string charset = 6; //@go_tags(`json:"charset"`) 编码格式(如utf-8)
|
|
string fund_bill_list = 7; //@go_tags(`json:"fund_bill_list"`) 支付方式明细(JSON字符串,如[{"amount":"0.01","fundChannel":"ALIPAYACCOUNT"}])
|
|
string gmt_create = 8; //@go_tags(`json:"gmt_create"`) 交易创建时间
|
|
string gmt_payment = 9; //@go_tags(`json:"gmt_payment"`) 支付时间
|
|
string invoice_amount = 10; //@go_tags(`json:"invoice_amount"`) 可开票金额
|
|
string notify_id = 11; //@go_tags(`json:"notify_id"`) 通知ID(唯一)
|
|
string notify_time = 12; //@go_tags(`json:"notify_time"`) 通知发送时间
|
|
string notify_type = 13; //@go_tags(`json:"notify_type"`) 通知类型(如trade_status_sync)
|
|
string out_trade_no = 14; //@go_tags(`json:"out_trade_no"`) 商户订单号(你的系统订单号)
|
|
string point_amount = 15; //@go_tags(`json:"point_amount"`) 积分支付金额
|
|
string receipt_amount = 16; //@go_tags(`json:"receipt_amount"`) 商家实收金额
|
|
string seller_email = 17; //@go_tags(`json:"seller_email"`) 卖家支付宝账号
|
|
string seller_id = 18; //@go_tags(`json:"seller_id"`) 卖家支付宝用户ID
|
|
string sign = 19; //@go_tags(`json:"sign"`) 签名
|
|
string sign_type = 20; //@go_tags(`json:"sign_type"`) 签名类型(如RSA2)
|
|
string subject = 21; //@go_tags(`json:"subject"`) 订单标题
|
|
string total_amount = 22; //@go_tags(`json:"total_amount"`) 订单总金额
|
|
string trade_no = 23; //@go_tags(`json:"trade_no"`) 支付宝交易号
|
|
string trade_status = 24; //@go_tags(`json:"trade_status"`) 交易状态(TRADE_SUCCESS表示成功)
|
|
string version = 25; //@go_tags(`json:"version"`) 版本号(如1.0)
|
|
}
|
|
|
|
message PayAlipayNotifyResp {
|
|
|
|
}
|
|
|
|
// PayPal 异步通知参数(包含验签所需头和原始 body)
|
|
message PayPayPalNotifyReq {
|
|
string transmission_id = 1; //@go_tags(`json:"transmission_id"`) PayPal-Transmission-Id
|
|
string transmission_time = 2; //@go_tags(`json:"transmission_time"`) PayPal-Transmission-Time
|
|
string cert_url = 3; //@go_tags(`json:"cert_url"`) PayPal-Cert-Url
|
|
string auth_algo = 4; //@go_tags(`json:"auth_algo"`) PayPal-Auth-Algo
|
|
string transmission_sig = 5; //@go_tags(`json:"transmission_sig"`) PayPal-Transmission-Sig
|
|
string webhook_id = 6; //@go_tags(`json:"webhook_id"`) Webhook-Id(配置的 WebhookID)
|
|
string body = 7; //@go_tags(`json:"body"`) 原始 JSON 通知体
|
|
}
|
|
|
|
message PayPayPalNotifyResp {
|
|
string code = 1; //@go_tags(`json:"code"`) 返回码
|
|
string message = 2; //@go_tags(`json:"message"`) 返回消息
|
|
}
|
|
|
|
// Apple IAP 异步通知参数(由网关层解析 JSON/values 后封装为 PB)
|
|
message PayAppleIAPNotifyReq {
|
|
string uid = 1; //@go_tags(`json:"uid"`) 用户ID
|
|
string order_id = 2; //@go_tags(`json:"order_id"`) 订单ID
|
|
string product_id = 3; //@go_tags(`json:"product_id"`) 商品ID或订阅ID
|
|
string receipt_data = 4; //@go_tags(`json:"receipt_data"`) 收据数据或交易ID
|
|
bool use_transaction_id = 5; //@go_tags(`json:"use_transaction_id"`) 是否使用交易ID模式校验
|
|
bool sandbox = 6; //@go_tags(`json:"sandbox"`) 是否沙箱环境
|
|
}
|
|
|
|
// Google IAP 异步通知参数(由网关层解析 JSON/values 后封装为 PB)
|
|
message PayGoogleIAPNotifyReq {
|
|
string uid = 1; //@go_tags(`json:"uid"`) 用户ID
|
|
string order_id = 2; //@go_tags(`json:"order_id"`) 订单ID
|
|
string package_name = 3; //@go_tags(`json:"package_name"`) 应用包名
|
|
string product_id = 4; //@go_tags(`json:"product_id"`) 商品ID或订阅ID
|
|
string purchase_token = 5; //@go_tags(`json:"purchase_token"`) 购买Token
|
|
bool is_subscription = 6; //@go_tags(`json:"is_subscription"`) 是否为订阅类型
|
|
}
|
|
|