wechat_notify.go 455 B

123456789101112131415161718192021
  1. //==================================
  2. // * Name:Jerry
  3. // * Tel:18017448610
  4. // * DateTime:2019/1/28 20:16
  5. //==================================
  6. package gopay
  7. import (
  8. "encoding/xml"
  9. "net/http"
  10. )
  11. func ParseNotifyResult(req *http.Request) (notifyRsp *WeChatNotifyResponse, err error) {
  12. notifyRsp = new(WeChatNotifyResponse)
  13. defer req.Body.Close()
  14. err = xml.NewDecoder(req.Body).Decode(notifyRsp)
  15. if err != nil {
  16. return nil, err
  17. }
  18. return
  19. }