// 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 }