api_transactions.go 2.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. // Copyright 2021 Tencent Inc. All rights reserved.
  2. //
  3. // 微信支付分账API
  4. //
  5. // 微信支付分账API
  6. //
  7. // API version: 0.0.3
  8. // Code generated by WechatPay APIv3 Generator based on [OpenAPI Generator](https://openapi-generator.tech); DO NOT EDIT.
  9. package profitsharing
  10. import (
  11. "context"
  12. "fmt"
  13. nethttp "net/http"
  14. neturl "net/url"
  15. "strings"
  16. "git.nanodreamtech.com/sg/wechatpay-go/core"
  17. "git.nanodreamtech.com/sg/wechatpay-go/core/consts"
  18. "git.nanodreamtech.com/sg/wechatpay-go/services"
  19. )
  20. type TransactionsApiService services.Service
  21. // QueryOrderAmount 查询剩余待分金额API
  22. //
  23. // 可调用此接口查询订单剩余待分金额
  24. //
  25. // 错误码列表
  26. // |名称|状态码|描述示例|原因|解决方案
  27. // |-|-|-|-|-|
  28. // |SYSTEM_ERROR|500|系统错误|系统超时|系统异常,请使用相同参数稍后重新调用|
  29. // |PARAM_ERROR|400|商户号未设置|请求参数不符合参数格式|请使用正确的参数重新调用|
  30. // |RATELIMIT_EXCEED|429|商户发起查询的频率过高|接口有频率限制|请降低频率后重试|
  31. // |INVALID_REQUEST|400|非分账订单不支持此查询|请求参数符合参数格式,但不符合业务规则|请根据返回的错误信息确认违反的业务规则|
  32. // |INVALID_REQUEST|400|非本商户的订单不支持查询|请求参数符合参数格式,但不符合业务规则|请根据返回的错误信息确认违反的业务规则|
  33. func (a *TransactionsApiService) QueryOrderAmount(ctx context.Context, req QueryOrderAmountRequest) (resp *QueryOrderAmountResponse, result *core.APIResult, err error) {
  34. var (
  35. localVarHTTPMethod = nethttp.MethodGet
  36. localVarPostBody interface{}
  37. localVarQueryParams neturl.Values
  38. localVarHeaderParams = nethttp.Header{}
  39. )
  40. // Make sure Path Params are properly set
  41. if req.TransactionId == nil {
  42. return nil, nil, fmt.Errorf("field `TransactionId` is required and must be specified in QueryOrderAmountRequest")
  43. }
  44. localVarPath := consts.WechatPayAPIServer + "/v3/profitsharing/transactions/{transaction_id}/amounts"
  45. // Build Path with Path Params
  46. localVarPath = strings.Replace(localVarPath, "{"+"transaction_id"+"}", neturl.PathEscape(core.ParameterToString(*req.TransactionId, "")), -1)
  47. // Make sure All Required Params are properly set
  48. // Determine the Content-Type Header
  49. localVarHTTPContentTypes := []string{}
  50. // Setup Content-Type
  51. localVarHTTPContentType := core.SelectHeaderContentType(localVarHTTPContentTypes)
  52. // Perform Http Request
  53. result, err = a.Client.Request(ctx, localVarHTTPMethod, localVarPath, localVarHeaderParams, localVarQueryParams, localVarPostBody, localVarHTTPContentType)
  54. if err != nil {
  55. return nil, result, err
  56. }
  57. // Extract QueryOrderAmountResponse from Http Response
  58. resp = new(QueryOrderAmountResponse)
  59. err = core.UnMarshalResponse(result.Response, resp)
  60. if err != nil {
  61. return nil, result, err
  62. }
  63. return resp, result, nil
  64. }