api_certificates.go 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. // Copyright 2021 Tencent Inc. All rights reserved.
  2. //
  3. // 微信支付平台证书下载服务
  4. //
  5. // 为了确保在定期更换平台证书时,不影响商户使用微信支付的各种功能,微信支付提供API接口供商户下载最新的平台证书。 商户可使用该接口实现平台证书的平滑切换。
  6. //
  7. // API version: 1.0.0
  8. // Code generated by WechatPay APIv3 Generator based on [OpenAPI Generator](https://openapi-generator.tech); DO NOT EDIT.
  9. package certificates
  10. import (
  11. "context"
  12. nethttp "net/http"
  13. neturl "net/url"
  14. "git.nanodreamtech.com/sg/wechatpay-go/core"
  15. "git.nanodreamtech.com/sg/wechatpay-go/core/consts"
  16. "git.nanodreamtech.com/sg/wechatpay-go/services"
  17. )
  18. type CertificatesApiService services.Service
  19. // DownloadCertificates 获取平台证书列表
  20. //
  21. // 获取商户当前可用的平台证书列表。微信支付提供该接口,帮助商户后台系统实现平台证书的平滑更换。
  22. func (a *CertificatesApiService) DownloadCertificates(ctx context.Context) (resp *DownloadCertificatesResponse, result *core.APIResult, err error) {
  23. var (
  24. localVarHTTPMethod = nethttp.MethodGet
  25. localVarPostBody interface{}
  26. localVarQueryParams neturl.Values
  27. localVarHeaderParams = nethttp.Header{}
  28. )
  29. localVarPath := consts.WechatPayAPIServer + "/v3/certificates"
  30. // Make sure All Required Params are properly set
  31. // Determine the Content-Type Header
  32. localVarHTTPContentTypes := []string{}
  33. // Setup Content-Type
  34. localVarHTTPContentType := core.SelectHeaderContentType(localVarHTTPContentTypes)
  35. // Perform Http Request
  36. result, err = a.Client.Request(ctx, localVarHTTPMethod, localVarPath, localVarHeaderParams, localVarQueryParams, localVarPostBody, localVarHTTPContentType)
  37. if err != nil {
  38. return nil, result, err
  39. }
  40. // Extract DownloadCertificatesResponse from Http Response
  41. resp = new(DownloadCertificatesResponse)
  42. err = core.UnMarshalResponse(result.Response, resp)
  43. if err != nil {
  44. return nil, result, err
  45. }
  46. return resp, result, nil
  47. }