wx_DownloadBill.go 789 B

1234567891011121314151617181920212223242526272829303132
  1. package wechat
  2. import (
  3. "fmt"
  4. "github.com/iGoogle-ink/gopay"
  5. "github.com/iGoogle-ink/gopay/wechat"
  6. )
  7. func DownloadBill() {
  8. //初始化微信客户端
  9. // appId:应用ID
  10. // MchID:商户ID
  11. // ApiKey:Key值
  12. // isProd:是否是正式环境
  13. client := wechat.NewClient("wxdaa2ab9ef87b5497", "1368139502", "GFDS8j98rewnmgl45wHTt980jg543abc", false)
  14. // 初始化参数结构体
  15. bm := make(gopay.BodyMap)
  16. bm.Set("nonce_str", gopay.GetRandomString(32))
  17. bm.Set("sign_type", wechat.SignType_MD5)
  18. bm.Set("bill_date", "20190722")
  19. bm.Set("bill_type", "ALL")
  20. //请求下载对账单,成功后得到结果(string类型字符串)
  21. wxRsp, err := client.DownloadBill(bm)
  22. if err != nil {
  23. fmt.Println("Error:", err)
  24. return
  25. }
  26. fmt.Println("wxRsp:", wxRsp)
  27. }