微信支付失败时输出信息
This commit is contained in:
@@ -283,10 +283,12 @@ func (a *API) AccessAPI(action string, requestParam IRequestBase) (retVal map[st
|
|||||||
requestParam.SetMchID(a.mchID)
|
requestParam.SetMchID(a.mchID)
|
||||||
requestParam.SetNonceStr(utils.GetUUID())
|
requestParam.SetNonceStr(utils.GetUUID())
|
||||||
requestParam.SetSignType(sigType)
|
requestParam.SetSignType(sigType)
|
||||||
requestParam.SetSign(a.signParam(utils.Struct2FlatMap(requestParam)))
|
signStr := a.signParam(utils.Struct2FlatMap(requestParam))
|
||||||
|
requestParam.SetSign(signStr)
|
||||||
|
|
||||||
fullURL := utils.GenerateGetURL(prodURL, action, nil)
|
fullURL := utils.GenerateGetURL(prodURL, action, nil)
|
||||||
|
|
||||||
|
var responseStr string
|
||||||
err = platformapi.AccessPlatformAPIWithRetry(a.client,
|
err = platformapi.AccessPlatformAPIWithRetry(a.client,
|
||||||
func() *http.Request {
|
func() *http.Request {
|
||||||
request, _ := http.NewRequest(http.MethodPost, fullURL, bytes.NewReader(mustMarshalXML(requestParam)))
|
request, _ := http.NewRequest(http.MethodPost, fullURL, bytes.NewReader(mustMarshalXML(requestParam)))
|
||||||
@@ -294,6 +296,7 @@ func (a *API) AccessAPI(action string, requestParam IRequestBase) (retVal map[st
|
|||||||
},
|
},
|
||||||
a.config,
|
a.config,
|
||||||
func(response *http.Response, bodyStr string, jsonResult1 map[string]interface{}) (errLevel string, err error) {
|
func(response *http.Response, bodyStr string, jsonResult1 map[string]interface{}) (errLevel string, err error) {
|
||||||
|
responseStr = bodyStr
|
||||||
if jsonResult1 == nil {
|
if jsonResult1 == nil {
|
||||||
return platformapi.ErrLevelRecoverableErr, fmt.Errorf("mapData is nil")
|
return platformapi.ErrLevelRecoverableErr, fmt.Errorf("mapData is nil")
|
||||||
}
|
}
|
||||||
@@ -303,6 +306,9 @@ func (a *API) AccessAPI(action string, requestParam IRequestBase) (retVal map[st
|
|||||||
if err == nil {
|
if err == nil {
|
||||||
if utils.Interface2String(retVal["result_code"]) != ResponseCodeSuccess {
|
if utils.Interface2String(retVal["result_code"]) != ResponseCodeSuccess {
|
||||||
err = utils.NewErrorCode(utils.Interface2String(retVal["err_code_des"]), utils.Interface2String(retVal["err_code"]))
|
err = utils.NewErrorCode(utils.Interface2String(retVal["err_code_des"]), utils.Interface2String(retVal["err_code"]))
|
||||||
|
if err != nil {
|
||||||
|
baseapi.SugarLogger.Debugf("wxpay AccessAPI %s failed:%s, err:%v", signStr, strings.ReplaceAll(responseStr, "\\n", " "), err)
|
||||||
|
}
|
||||||
retVal = nil
|
retVal = nil
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user