通联宝apixiugai
This commit is contained in:
@@ -1 +1,52 @@
|
||||
package tonglianpayapi
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"io/ioutil"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
const (
|
||||
MsgTypeUnkown = 0 // 未知
|
||||
MsgTypePay = "VSP501" // 支付结果回调
|
||||
MsgTypeRefund = "VSP503" // 退款结果回调
|
||||
|
||||
TrxStatusSuccess = "0000"
|
||||
)
|
||||
|
||||
type CallBackResult struct {
|
||||
AppID string `json:"appID"`
|
||||
OuttrxID string `json:"outtrxID"`
|
||||
TrxCode string `json:"trxCode"`
|
||||
TrxID string `json:"trxID"`
|
||||
TrxAmt int `json:"trxAmt"`
|
||||
TrxDate string `json:"trxDate"`
|
||||
PayTime string `json:"payTime"`
|
||||
ChnlTrxID string `json:"chnlTrxID"`
|
||||
TrxStatus string `json:"trxStatus"`
|
||||
CusID string `json:"cusID"`
|
||||
TermNo string `json:"termNo"`
|
||||
TermBatchid string `json:"termBatchid"`
|
||||
TermTraceno string `json:"termTraceno"`
|
||||
TermAuthno string `json:"termAuthno"`
|
||||
TermRefnum string `json:"termRefnum"`
|
||||
TrxReserved string `json:"trxReserved"`
|
||||
SrcTrxid string `json:"srcTrxid"`
|
||||
CusorderID string `json:"cusorderID"`
|
||||
Acct string `json:"acct"`
|
||||
Fee string `json:"fee"`
|
||||
SignType string `json:"signType"`
|
||||
Cmid string `json:"cmid"`
|
||||
Chnlid string `json:"chnlid"`
|
||||
Sign string `json:"sign"`
|
||||
}
|
||||
|
||||
func (a *API) GetCallbackMsg(request *http.Request) (call *CallBackResult, err error) {
|
||||
data, err := ioutil.ReadAll(request.Body)
|
||||
call = &CallBackResult{}
|
||||
json.Unmarshal(data, &call)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return call, err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user