-
Notifications
You must be signed in to change notification settings - Fork 151
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
微信支付下单返回err=nil但是原始数据StatusCode=400错误 #514
Comments
你这个不能判断error为依据,因为请求没有出错。 这里的err是请求过程中异常报错。 而微信返回的内容是正常的,给了业务code的错误信息, 你要通过判断code如果不等于0的情况,然后做相应处理 |
要加上这样处理吗: response, err := payment.Order.JSAPITransaction(ctx, options)
if err != nil {
return nil, err
}
if response.Code != "" {
return nil, errors.New(response.Message)
} |
是的,官网返回的code,正常应该是0 |
我看请求的 returnResponse, err := df.Request()
if err != nil {
return returnResponse, err
} 发送http请求后,没有找到close的地方,这个会导致内存泄漏吗? |
这个封装的层,还在看底层的请求层 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
微信支付下单的代码:
如果直接判断 err 为nil,但是微信返回的原始错误为:
type ResponseUnitfy struct {
response.ResponsePayment
}
结构体都是空。
err = client.HttpHelper.ParseResponseBodyContent(returnResponse, outBody) 封装的时候没有判断具体数据错误问题。
The text was updated successfully, but these errors were encountered: