-
Notifications
You must be signed in to change notification settings - Fork 149
/
Copy pathapi_user_services.go
80 lines (67 loc) · 2.78 KB
/
api_user_services.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
// Copyright 2021 Tencent Inc. All rights reserved.
//
// 公共出行平台代扣服务对外API
//
// 公共出行平台代扣服务对外API
//
// API version: 1.0.0
// Code generated by WechatPay APIv3 Generator based on [OpenAPI Generator](https://openapi-generator.tech); DO NOT EDIT.
package weixinpayscanandride
import (
"context"
"fmt"
nethttp "net/http"
neturl "net/url"
"strings"
"github.com/wechatpay-apiv3/wechatpay-go/core"
"github.com/wechatpay-apiv3/wechatpay-go/core/consts"
"github.com/wechatpay-apiv3/wechatpay-go/services"
)
type UserServicesApiService services.Service
// QueryUserService 查询用户服务可用信息
//
// 在商户生成乘车码前,商户请求查询用户服务可用信息接口,查询 用户服务可用信息,通过用户服务可用信息中的服务可用状态,来判断是否可以正常使用公共出行代扣服务
func (a *UserServicesApiService) QueryUserService(ctx context.Context, req QueryUserServiceRequest) (resp *UserServiceEntity, result *core.APIResult, err error) {
var (
localVarHTTPMethod = nethttp.MethodGet
localVarPostBody interface{}
localVarQueryParams neturl.Values
localVarHeaderParams = nethttp.Header{}
)
// Make sure Path Params are properly set
if req.ContractId == nil {
return nil, nil, fmt.Errorf("field `ContractId` is required and must be specified in QueryUserServiceRequest")
}
localVarPath := consts.WechatPayAPIServer + "/v3/qrcode/user-services/contract-id/{contract_id}"
// Build Path with Path Params
localVarPath = strings.Replace(localVarPath, "{"+"contract_id"+"}", neturl.PathEscape(core.ParameterToString(*req.ContractId, "")), -1)
// Make sure All Required Params are properly set
if req.Appid == nil {
return nil, nil, fmt.Errorf("field `Appid` is required and must be specified in QueryUserServiceRequest")
}
// Setup Query Params
localVarQueryParams = neturl.Values{}
localVarQueryParams.Add("appid", core.ParameterToString(*req.Appid, ""))
if req.SubAppid != nil {
localVarQueryParams.Add("sub_appid", core.ParameterToString(*req.SubAppid, ""))
}
if req.SubMchid != nil {
localVarQueryParams.Add("sub_mchid", core.ParameterToString(*req.SubMchid, ""))
}
// Determine the Content-Type Header
localVarHTTPContentTypes := []string{}
// Setup Content-Type
localVarHTTPContentType := core.SelectHeaderContentType(localVarHTTPContentTypes)
// Perform Http Request
result, err = a.Client.Request(ctx, localVarHTTPMethod, localVarPath, localVarHeaderParams, localVarQueryParams, localVarPostBody, localVarHTTPContentType)
if err != nil {
return nil, result, err
}
// Extract UserServiceEntity from Http Response
resp = new(UserServiceEntity)
err = core.UnMarshalResponse(result.Response, resp)
if err != nil {
return nil, result, err
}
return resp, result, nil
}