This commit is contained in:
邹宗楠
2022-06-02 10:13:26 +08:00
parent dad0d7bb19
commit 7de52d4ab3
6 changed files with 85 additions and 80 deletions

View File

@@ -16,43 +16,6 @@ const (
TtPayWay = "10" // 10-抖音支付
)
type CallBackResult struct {
Timestamp int `json:"timestamp"` // Unix 时间戳10 位,整型数
Nonce string `json:"nonce"` // 随机数
Msg string `json:"msg"` // 订单信息的 json 字符串
TypePay string `json:"type"` // 回调类型标记,支付成功回调为"payment"
Msgsignature string `json:"msgsignature"` // 签名,详见
}
// 详细信息MSG(支付回调)
type DetailCallBackMessage struct {
AppId string `json:"appid"` // 当前交易发起的小程序id
CpOrderno string `json:"cp_orderno"` // 开发者侧的订单号
CpExtra string `json:"cp_extra"` // 预下单时开发者传入字段
Way string `json:"way"` // way 字段中标识了支付渠道1-微信支付2-支付宝支付10-抖音支付
ChannelNo string `json:"channel_no"` // 支付渠道侧单号
PaymentOrderNo string `json:"payment_order_no"` // 支付渠道侧商家订单号
TotalAmount int64 `json:"total_amount"` // 支付金额,单位为分
Status string `json:"status"` // 固定SUCCESS
ItemId string `json:"item_id"` // 订单来源视频对应视频 id
SellerUid string `json:"seller_uid"` // 该笔交易卖家商户号
PaidAt int64 `json:"paid_at"` // 支付时间Unix 时间戳10 位,整型数
OrderId string `json:"order_id"` // 抖音侧订单号
}
// 详细信息MSG(退款回调)
type DetailCallBackMessage2Refund struct {
AppId string `json:"appid"` // 当前交易发起的小程序id
CpRefundno string `json:"cp_refundno"` // 开发者侧的退款订单号
CpExtra string `json:"cp_extra"` // 预下单时开发者传入字段
Status string `json:"status"` // 固定SUCCESS/FAIL
RefundAmount int64 `json:"refund_amount"` // 退款金额
RefundedAt int64 `json:"refunded_at"` // 退款时间
Message string `json:"message"` // 退款失败描述
OrderId string `json:"order_id"` // 抖音侧订单号
}
func (a *API) GetCallbackMsg(request *http.Request) (call *DetailCallBackMessage, refund *DetailCallBackMessage2Refund, payType string, err error) {
data, err := ioutil.ReadAll(request.Body)
if err != nil {