- call parseForm explicit for http.Response
This commit is contained in:
@@ -50,22 +50,25 @@ func Err2CallbackResponse(err error, data string) *CallbackResponse {
|
||||
}
|
||||
|
||||
func (a *API) CheckCallbackValidation(request *http.Request) (callbackResponse *CallbackResponse) {
|
||||
request.ParseForm()
|
||||
sign := a.signParams(request.PostForm)
|
||||
if sign != request.FormValue(signKey) {
|
||||
baseapi.SugarLogger.Infof("Signature is not ok, mine:%v, get:%v", sign, request.FormValue(signKey))
|
||||
return SignatureIsNotOk
|
||||
}
|
||||
err := request.ParseForm()
|
||||
if err == nil {
|
||||
sign := a.signParams(request.PostForm)
|
||||
if sign != request.FormValue(signKey) {
|
||||
baseapi.SugarLogger.Infof("Signature is not ok, mine:%v, get:%v", sign, request.FormValue(signKey))
|
||||
return SignatureIsNotOk
|
||||
}
|
||||
|
||||
for _, valueKey := range []string{"delivery_id", "mt_peisong_id", "order_id"} {
|
||||
if request.FormValue(valueKey) == "" {
|
||||
baseapi.SugarLogger.Errorf("Missing mandatory param PostForm:%v, valueKey:%v", request.PostForm, valueKey)
|
||||
return &CallbackResponse{
|
||||
Code: -1,
|
||||
for _, valueKey := range []string{"delivery_id", "mt_peisong_id", "order_id"} {
|
||||
if request.FormValue(valueKey) == "" {
|
||||
baseapi.SugarLogger.Errorf("Missing mandatory param PostForm:%v, valueKey:%v", request.PostForm, valueKey)
|
||||
return &CallbackResponse{
|
||||
Code: -1,
|
||||
}
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
return nil
|
||||
return Err2CallbackResponse(err, "")
|
||||
}
|
||||
|
||||
func (a *API) GetOrderCallbackMsg(request *http.Request) (orderMsg *CallbackOrderMsg, callbackResponse *CallbackResponse) {
|
||||
|
||||
Reference in New Issue
Block a user