77 lines
1.7 KiB
Plaintext
77 lines
1.7 KiB
Plaintext
syntax = "v1"
|
||
|
||
info (
|
||
title: "支付服务"
|
||
desc: "支付服务"
|
||
version: "v1"
|
||
)
|
||
|
||
@server (
|
||
prefix: api/v1
|
||
group: pay
|
||
)
|
||
service main {
|
||
// 微信支付回调
|
||
@handler WechatPayCallback
|
||
post /pay/wechat/callback
|
||
|
||
// 支付宝支付回调
|
||
@handler AlipayCallback
|
||
post /pay/alipay/callback
|
||
|
||
// 支付宝from消息回调
|
||
@handler AlipayFrom
|
||
post /pay/alipay/from
|
||
|
||
// 微信退款回调
|
||
@handler WechatPayRefundCallback
|
||
post /pay/wechat/refund_callback
|
||
}
|
||
|
||
@server (
|
||
prefix: api/v1
|
||
group: pay
|
||
jwt: JwtAuth
|
||
middleware: AuthInterceptor
|
||
)
|
||
service main {
|
||
// 支付
|
||
@handler Payment
|
||
post /pay/payment (PaymentReq) returns (PaymentResp)
|
||
|
||
@handler IapCallback
|
||
post /pay/iap_callback (IapCallbackReq)
|
||
|
||
@handler PaymentCheck
|
||
post /pay/check (PaymentCheckReq) returns (PaymentCheckResp)
|
||
}
|
||
|
||
type (
|
||
PaymentReq {
|
||
Id string `json:"id"`
|
||
PayMethod string `json:"pay_method"` // 支付方式: wechat, alipay, appleiap, test(仅开发环境), test_empty(仅开发环境-空报告模式)
|
||
PayType string `json:"pay_type" validate:"required,oneof=query agent_vip agent_upgrade whitelist"`
|
||
Code string `json:"code,optional"` // 微信小程序登录 code,未绑定 openid 时传此参数以换取 openid 并调起支付
|
||
}
|
||
PaymentResp {
|
||
PrepayData interface{} `json:"prepay_data"`
|
||
PrepayId string `json:"prepay_id"`
|
||
OrderNo string `json:"order_no"`
|
||
}
|
||
PaymentCheckReq {
|
||
OrderNo string `json:"order_no" validate:"required"`
|
||
}
|
||
PaymentCheckResp {
|
||
Type string `json:"type"`
|
||
Status string `json:"status"`
|
||
}
|
||
)
|
||
|
||
type (
|
||
IapCallbackReq {
|
||
OrderID string `json:"order_id" validate:"required"`
|
||
TransactionReceipt string `json:"transaction_receipt" validate:"required"`
|
||
}
|
||
)
|
||
|