-
Notifications
You must be signed in to change notification settings - Fork 149
/
api_transfer_detail.go
131 lines (108 loc) · 5.61 KB
/
api_transfer_detail.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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
// Copyright 2021 Tencent Inc. All rights reserved.
//
// 商家转账对外API
//
// * 场景及业务流程: 商户可通过该产品实现同时向多个用户微信零钱进行转账的操作,可用于发放奖金补贴、佣金货款结算、员工报销等场景。 [https://pay.weixin.qq.com/index.php/public/product/detail?pid=108&productType=0](https://pay.weixin.qq.com/index.php/public/product/detail?pid=108&productType=0) * 接入步骤: * 商户在微信支付商户平台开通“批量转账到零钱”产品权限,并勾选“使用API方式发起转账”。 * 调用批量转账接口,对多个用户微信零钱发起转账。 * 调用查询批次接口,可获取到转账批次详情及当前状态。 * 调用查询明细接口,可获取到单条转账明细详情及当前状态。
//
// API version: 1.0.5
// Code generated by WechatPay APIv3 Generator based on [OpenAPI Generator](https://openapi-generator.tech); DO NOT EDIT.
package transferbatch
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 TransferDetailApiService services.Service
// GetTransferDetailByNo 通过微信明细单号查询明细单
//
// 明细单号查单接口。商户可以通过该接口查询单笔转账明细单。返回消息中包含微信明细单号、明细状态、转账金额、失败原因、收款用户姓名、用户OpenID等信息。
func (a *TransferDetailApiService) GetTransferDetailByNo(ctx context.Context, req GetTransferDetailByNoRequest) (resp *TransferDetailEntity, 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.BatchId == nil {
return nil, nil, fmt.Errorf("field `BatchId` is required and must be specified in GetTransferDetailByNoRequest")
}
if req.DetailId == nil {
return nil, nil, fmt.Errorf("field `DetailId` is required and must be specified in GetTransferDetailByNoRequest")
}
localVarPath := consts.WechatPayAPIServer + "/v3/transfer/batches/batch-id/{batch_id}/details/detail-id/{detail_id}"
// Build Path with Path Params
localVarPath = strings.Replace(localVarPath, "{"+"batch_id"+"}", neturl.PathEscape(core.ParameterToString(*req.BatchId, "")), -1)
localVarPath = strings.Replace(localVarPath, "{"+"detail_id"+"}", neturl.PathEscape(core.ParameterToString(*req.DetailId, "")), -1)
// Make sure All Required Params are properly set
// 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 TransferDetailEntity from Http Response
resp = new(TransferDetailEntity)
err = core.UnMarshalResponse(result.Response, resp)
if err != nil {
return nil, result, err
}
// 对应答中隐私字段进行解密
err = a.Client.DecryptResponse(ctx, resp)
if err != nil {
return resp, result, err
}
return resp, result, nil
}
// GetTransferDetailByOutNo 通过商家明细单号查询明细单
//
// 商户明细单号查单接口。商户可以通过该接口查询单笔转账明细单。返回消息中包含微信明细单号、明细状态、转账金额、失败原因、收款用户姓名、用户OpenID等信息。
func (a *TransferDetailApiService) GetTransferDetailByOutNo(ctx context.Context, req GetTransferDetailByOutNoRequest) (resp *TransferDetailEntity, 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.OutDetailNo == nil {
return nil, nil, fmt.Errorf("field `OutDetailNo` is required and must be specified in GetTransferDetailByOutNoRequest")
}
if req.OutBatchNo == nil {
return nil, nil, fmt.Errorf("field `OutBatchNo` is required and must be specified in GetTransferDetailByOutNoRequest")
}
localVarPath := consts.WechatPayAPIServer + "/v3/transfer/batches/out-batch-no/{out_batch_no}/details/out-detail-no/{out_detail_no}"
// Build Path with Path Params
localVarPath = strings.Replace(localVarPath, "{"+"out_detail_no"+"}", neturl.PathEscape(core.ParameterToString(*req.OutDetailNo, "")), -1)
localVarPath = strings.Replace(localVarPath, "{"+"out_batch_no"+"}", neturl.PathEscape(core.ParameterToString(*req.OutBatchNo, "")), -1)
// Make sure All Required Params are properly set
// 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 TransferDetailEntity from Http Response
resp = new(TransferDetailEntity)
err = core.UnMarshalResponse(result.Response, resp)
if err != nil {
return nil, result, err
}
// 对应答中隐私字段进行解密
err = a.Client.DecryptResponse(ctx, resp)
if err != nil {
return resp, result, err
}
return resp, result, nil
}