- dadaapi added.
- refactor.
This commit is contained in:
@@ -39,7 +39,7 @@ var (
|
||||
SignatureIsNotOk = &MtpsCallbackResponse{Code: -1}
|
||||
)
|
||||
|
||||
func (m *MTPSAPI) CheckRequestValidation(request *http.Request) (callbackResponse *MtpsCallbackResponse) {
|
||||
func (m *MTPSAPI) CheckCallbackValidation(request *http.Request) (callbackResponse *MtpsCallbackResponse) {
|
||||
request.ParseForm()
|
||||
sign := m.signParams(request.PostForm)
|
||||
if sign != request.FormValue(signKey) {
|
||||
@@ -59,8 +59,7 @@ func (m *MTPSAPI) CheckRequestValidation(request *http.Request) (callbackRespons
|
||||
}
|
||||
|
||||
func (m *MTPSAPI) GetOrderCallbackMsg(request *http.Request) (orderMsg *MtpsCallbackOrderMsg, callbackResponse *MtpsCallbackResponse) {
|
||||
callbackResponse = m.CheckRequestValidation(request)
|
||||
if callbackResponse != nil {
|
||||
if callbackResponse = m.CheckCallbackValidation(request); callbackResponse != nil {
|
||||
return nil, callbackResponse
|
||||
}
|
||||
orderMsg = &MtpsCallbackOrderMsg{
|
||||
@@ -84,8 +83,7 @@ func (m *MTPSAPI) GetOrderCallbackMsg(request *http.Request) (orderMsg *MtpsCall
|
||||
}
|
||||
|
||||
func (m *MTPSAPI) GetOrderExceptionCallbackMsg(request *http.Request) (orderMsg *MtpsCallbackOrderExceptionMsg, callbackResponse *MtpsCallbackResponse) {
|
||||
callbackResponse = m.CheckRequestValidation(request)
|
||||
if callbackResponse != nil {
|
||||
if callbackResponse = m.CheckCallbackValidation(request); callbackResponse != nil {
|
||||
return nil, callbackResponse
|
||||
}
|
||||
orderMsg = &MtpsCallbackOrderExceptionMsg{
|
||||
|
||||
@@ -107,20 +107,20 @@ type MTPSResult struct {
|
||||
}
|
||||
|
||||
type MtpsCreateOrderByShopInfo struct {
|
||||
DeliveryId int64 `structs:"delivery_id"`
|
||||
OrderId string `structs:"order_id"`
|
||||
ShopId string `structs:"shop_id"`
|
||||
DeliveryServiceCode int `structs:"delivery_service_code"`
|
||||
ReceiverName string `structs:"receiver_name"`
|
||||
ReceiverAddress string `structs:"receiver_address"`
|
||||
ReceiverPhone string `structs:"receiver_phone"`
|
||||
ReceiverLng int `structs:"receiver_lng"`
|
||||
ReceiverLat int `structs:"receiver_lat"`
|
||||
CoordinateType int `structs:"coordinate_type"`
|
||||
GoodsValue float64 `structs:"goods_value"`
|
||||
GoodsWeight float64 `structs:"goods_weight"`
|
||||
ExpectedDeliveryTime int64 `structs:"expected_delivery_time"`
|
||||
OrderType int `structs:"order_type"`
|
||||
DeliveryId int64 `json:"delivery_id"`
|
||||
OrderId string `json:"order_id"`
|
||||
ShopId string `json:"shop_id"`
|
||||
DeliveryServiceCode int `json:"delivery_service_code"`
|
||||
ReceiverName string `json:"receiver_name"`
|
||||
ReceiverAddress string `json:"receiver_address"`
|
||||
ReceiverPhone string `json:"receiver_phone"`
|
||||
ReceiverLng int `json:"receiver_lng"`
|
||||
ReceiverLat int `json:"receiver_lat"`
|
||||
CoordinateType int `json:"coordinate_type"`
|
||||
GoodsValue float64 `json:"goods_value"`
|
||||
GoodsWeight float64 `json:"goods_weight"`
|
||||
ExpectedDeliveryTime int64 `json:"expected_delivery_time"`
|
||||
OrderType int `json:"order_type"`
|
||||
}
|
||||
|
||||
type MTPSAPI struct {
|
||||
|
||||
Reference in New Issue
Block a user