|
@@ -1,6 +1,7 @@
|
|
|
package wx
|
|
package wx
|
|
|
|
|
|
|
|
import (
|
|
import (
|
|
|
|
|
+ "encoding/xml"
|
|
|
"errors"
|
|
"errors"
|
|
|
"fmt"
|
|
"fmt"
|
|
|
"git.qianqiusoft.com/qianqiusoft/light-apiengine/entitys"
|
|
"git.qianqiusoft.com/qianqiusoft/light-apiengine/entitys"
|
|
@@ -27,14 +28,19 @@ func CallWxPayCallbackHandler(c *entitys.CtrlContext)models.SysReturn{
|
|
|
if wxPayCallbackHandler == nil{
|
|
if wxPayCallbackHandler == nil{
|
|
|
return models.SysReturn{500, "微信支付回调处理函数为空", nil}
|
|
return models.SysReturn{500, "微信支付回调处理函数为空", nil}
|
|
|
}
|
|
}
|
|
|
|
|
+ data, err := ioutil.ReadAll(c.Ctx.Request.Body)
|
|
|
|
|
+ if err != nil{
|
|
|
|
|
+ fmt.Println("******************----》微信支付回调read request body错误", err.Error())
|
|
|
|
|
+ return models.SysReturn{500, err.Error(), nil}
|
|
|
|
|
+ }
|
|
|
notifyRet := pay.NotifyResult{}
|
|
notifyRet := pay.NotifyResult{}
|
|
|
- err := c.Ctx.BindXML(¬ifyRet)
|
|
|
|
|
|
|
+ err = xml.Unmarshal(data, ¬ifyRet)
|
|
|
|
|
+ //err = c.Ctx.BindXML(¬ifyRet)
|
|
|
if err != nil{
|
|
if err != nil{
|
|
|
fmt.Println("******************----》微信支付回调bindxml错误", err.Error())
|
|
fmt.Println("******************----》微信支付回调bindxml错误", err.Error())
|
|
|
return models.SysReturn{500, err.Error(), nil}
|
|
return models.SysReturn{500, err.Error(), nil}
|
|
|
}
|
|
}
|
|
|
if notifyRet.ResultCode == "SUCCESS" && notifyRet.ReturnCode == "SUCCESS"{
|
|
if notifyRet.ResultCode == "SUCCESS" && notifyRet.ReturnCode == "SUCCESS"{
|
|
|
- var data, _ = ioutil.ReadAll(c.Ctx.Request.Body)
|
|
|
|
|
ok, err := VerifyResponseData(data, wxConfig.PayKey)
|
|
ok, err := VerifyResponseData(data, wxConfig.PayKey)
|
|
|
if err != nil{
|
|
if err != nil{
|
|
|
fmt.Println("*****************---->微信支付回调验证错误", err.Error())
|
|
fmt.Println("*****************---->微信支付回调验证错误", err.Error())
|