- business msg added to error
This commit is contained in:
@@ -49,6 +49,7 @@ func (e *ELMAPI) unmarshalData(data []byte, msg interface{}) (callbackResponse *
|
|||||||
func (e *ELMAPI) CheckRequestValidation(mapData map[string]interface{}) (callbackResponse *ELMCallbackResponse) {
|
func (e *ELMAPI) CheckRequestValidation(mapData map[string]interface{}) (callbackResponse *ELMCallbackResponse) {
|
||||||
sign := e.signParamsMap(mapData, "")
|
sign := e.signParamsMap(mapData, "")
|
||||||
if sign != mapData[signKey].(string) {
|
if sign != mapData[signKey].(string) {
|
||||||
|
e.sugarLogger.Infof("Signature is not ok, mine:%v, get:%v", sign, mapData[signKey].(string))
|
||||||
return &ELMCallbackResponse{Message: "signature is invalid"}
|
return &ELMCallbackResponse{Message: "signature is invalid"}
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
|
|||||||
@@ -153,7 +153,7 @@ func (e *ELMAPI) AccessELM(action string, params map[string]interface{}) (retVal
|
|||||||
} else if errCode == "SERVER_ERROR" || errCode == "BIZ_SYSTEM_ERROR" || errCode == "BIZ_1006" || errCode == "BUSINESS_ERROR" {
|
} else if errCode == "SERVER_ERROR" || errCode == "BIZ_SYSTEM_ERROR" || errCode == "BIZ_1006" || errCode == "BUSINESS_ERROR" {
|
||||||
return common.PAErrorLevelRecoverable, nil
|
return common.PAErrorLevelRecoverable, nil
|
||||||
} else {
|
} else {
|
||||||
return errCode, nil
|
return common.PAErrorLevelGeneralFail, utils.NewErrorCode(errinfoMap["message"].(string), errCode)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
@@ -66,6 +66,7 @@ func (j *JDAPI) CheckRequestValidation(request *http.Request) (callbackResponse
|
|||||||
|
|
||||||
sign := j.signParams(mapData)
|
sign := j.signParams(mapData)
|
||||||
if sign != request.FormValue(signKey) {
|
if sign != request.FormValue(signKey) {
|
||||||
|
j.sugarLogger.Infof("Signature is not ok, mine:%v, get:%v", sign, request.FormValue(signKey))
|
||||||
return &JDCallbackResponse{
|
return &JDCallbackResponse{
|
||||||
Code: JDerrorCodeInvalidSign,
|
Code: JDerrorCodeInvalidSign,
|
||||||
Msg: "signature is invalid",
|
Msg: "signature is invalid",
|
||||||
|
|||||||
@@ -190,7 +190,7 @@ func (j *JDAPI) AccessJDQuery(apiStr string, jdParams map[string]string) (retVal
|
|||||||
} else if _, ok := canRetryCodes[code]; ok {
|
} else if _, ok := canRetryCodes[code]; ok {
|
||||||
return common.PAErrorLevelRecoverable, nil
|
return common.PAErrorLevelRecoverable, nil
|
||||||
} else {
|
} else {
|
||||||
return code, nil
|
return common.PAErrorLevelGeneralFail, utils.NewErrorCode(jsonResult1["msg"].(string), code)
|
||||||
}
|
}
|
||||||
|
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -42,10 +42,12 @@ func (m *MTPSAPI) CheckRequestValidation(request *http.Request) (callbackRespons
|
|||||||
request.ParseForm()
|
request.ParseForm()
|
||||||
sign := m.signParams(request.PostForm)
|
sign := m.signParams(request.PostForm)
|
||||||
if sign != request.FormValue(signKey) {
|
if sign != request.FormValue(signKey) {
|
||||||
|
m.sugarLogger.Infof("Signature is not ok, mine:%v, get:%v", sign, request.FormValue(signKey))
|
||||||
return SignatureIsNotOk
|
return SignatureIsNotOk
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, valueKey := range []string{"delivery_id", "mt_peisong_id", "order_id"} {
|
for _, valueKey := range []string{"delivery_id", "mt_peisong_id", "order_id"} {
|
||||||
|
m.sugarLogger.Errorf("Missing mandatory param:%v", valueKey)
|
||||||
if request.FormValue(valueKey) == "" {
|
if request.FormValue(valueKey) == "" {
|
||||||
return &MtpsCallbackResponse{
|
return &MtpsCallbackResponse{
|
||||||
Code: -1,
|
Code: -1,
|
||||||
|
|||||||
Reference in New Issue
Block a user