Files
jx-callback/business/partner/purchase/jx/callback.go
2019-09-02 18:33:43 +08:00

37 lines
902 B
Go

package jx
import "fmt"
const (
appKey = "4A86853D-E4B6-454E-940A-B68ECDA2B73E"
MsgTypeOrder = "order"
SubMsgTypeOrderNew = "newOrder"
SubMsgTypeOrderAdjust = "adjustOrder"
SubMsgTypeOrderApplyCancel = "applyCancel"
// SubMsgTypeOrderApplayRefund = "applyRefund"
)
type CallbackResponse struct {
Code int `json:"code"`
Data string `json:"data"`
}
type CallbackMsg struct {
AppKey string `json:"appKey"`
MsgType string `json:"msgType"`
SubMsgType string `json:"subMsgType"`
ThingID string `json:"thingID"`
Data string `json:"data"`
}
func OnCallbackMsg(msg *CallbackMsg) (retVal, errCode string, err error) {
if msg.AppKey != appKey {
return retVal, errCode, fmt.Errorf("无效的AppKey:%s", msg.AppKey)
}
if msg.MsgType == MsgTypeOrder {
retVal, errCode, err = CurPurchaseHandler.OnOrderMsg(msg)
}
return retVal, errCode, err
}