wx_DownloadFundFlow.go 974 B

123456789101112131415161718192021222324252627282930313233
  1. package wechat
  2. import (
  3. "fmt"
  4. "github.com/iGoogle-ink/gopay"
  5. "github.com/iGoogle-ink/gopay/wechat"
  6. )
  7. func DownloadFundFlow() {
  8. //初始化微信客户端
  9. // appId:应用ID
  10. // MchID:商户ID
  11. // ApiKey:Key值
  12. // isProd:是否是正式环境
  13. // 好像不支持沙箱环境,因为沙箱环境默认需要用MD5签名,但是此接口仅支持HMAC-SHA256签名
  14. client := wechat.NewClient("wxdaa2ab9ef87b5497", "1368139502", "GFDS8j98rewnmgl45wHTt980jg543abc", false)
  15. // 初始化参数结构体
  16. bm := make(gopay.BodyMap)
  17. bm.Set("nonce_str", gopay.GetRandomString(32))
  18. bm.Set("sign_type", wechat.SignType_HMAC_SHA256)
  19. bm.Set("bill_date", "20190122")
  20. bm.Set("account_type", "Basic")
  21. // 请求下载资金账单,成功后得到结果,沙箱环境下,证书路径参数可传空
  22. wxRsp, err := client.DownloadFundFlow(bm, nil, nil, nil)
  23. if err != nil {
  24. fmt.Println("Error:", err)
  25. return
  26. }
  27. fmt.Println("wxRsp:", wxRsp)
  28. }