|
|
@ -9,31 +9,30 @@ import (
|
|
|
|
|
|
|
|
|
|
|
|
type TransferBatchesOutBatchNoResponse struct {
|
|
|
|
type TransferBatchesOutBatchNoResponse struct {
|
|
|
|
TransferBatch struct {
|
|
|
|
TransferBatch struct {
|
|
|
|
Mchid string `json:"mchid"` // 商户号
|
|
|
|
Mchid string `json:"mchid"` // 微信支付分配的商户号
|
|
|
|
OutBatchNo string `json:"out_batch_no"` // 商家批次单号
|
|
|
|
OutBatchNo string `json:"out_batch_no"` // 商户系统内部的商家批次单号,在商户系统内部唯一
|
|
|
|
BatchId string `json:"batch_id"` // 微信批次单号
|
|
|
|
BatchId string `json:"batch_id"` // 微信批次单号,微信商家转账系统返回的唯一标识
|
|
|
|
Appid string `json:"appid"` // 直连商户的appid
|
|
|
|
Appid string `json:"appid"` // 申请商户号的appid或商户号绑定的appid(企业号corpid即为此appid)
|
|
|
|
BatchStatus string `json:"batch_status"` // 批次状态
|
|
|
|
BatchStatus string `json:"batch_status"` // WAIT_PAY: 待付款确认。需要付款出资商户在商家助手小程序或服务商助手小程序进行付款确认 ACCEPTED:已受理。批次已受理成功,若发起批量转账的30分钟后,转账批次单仍处于该状态,可能原因是商户账户余额不足等。商户可查询账户资金流水,若该笔转账批次单的扣款已经发生,则表示批次已经进入转账中,请再次查单确认 PROCESSING:转账中。已开始处理批次内的转账明细单 FINISHED:已完成。批次内的所有转账明细单都已处理完成 CLOSED:已关闭。可查询具体的批次关闭原因确认
|
|
|
|
BatchType string `json:"batch_type"` // 批次类型
|
|
|
|
BatchType string `json:"batch_type"` // API:API方式发起 WEB:页面方式发起
|
|
|
|
BatchName string `json:"batch_name"` // 批次名称
|
|
|
|
BatchName string `json:"batch_name"` // 该笔批量转账的名称
|
|
|
|
BatchRemark string `json:"batch_remark"` // 批次备注
|
|
|
|
BatchRemark string `json:"batch_remark"` // 转账说明,UTF8编码,最多允许32个字符
|
|
|
|
CloseReason string `json:"close_reason,omitempty"` // 批次关闭原因
|
|
|
|
CloseReason string `json:"close_reason,omitempty"` // 如果批次单状态为“CLOSED”(已关闭),则有关闭原因
|
|
|
|
TotalAmount int `json:"total_amount"` // 转账总金额
|
|
|
|
TotalAmount int `json:"total_amount"` // 转账金额单位为“分”
|
|
|
|
TotalNum int `json:"total_num"` // 转账总笔数
|
|
|
|
TotalNum int `json:"total_num"` // 一个转账批次单最多发起三千笔转账
|
|
|
|
CreateTime string `json:"create_time"` // 批次创建时间
|
|
|
|
CreateTime string `json:"create_time"` // 批次受理成功时返回,按照使用rfc3339所定义的格式,格式为YYYY-MM-DDThh:mm:ss+TIMEZONE
|
|
|
|
UpdateTime string `json:"update_time"` // 批次更新时间
|
|
|
|
UpdateTime string `json:"update_time"` // 批次最近一次状态变更的时间,按照使用rfc3339所定义的格式,格式为YYYY-MM-DDThh:mm:ss+TIMEZONE
|
|
|
|
SuccessAmount int `json:"success_amount"` // 转账成功金额
|
|
|
|
SuccessAmount int `json:"success_amount"` // 转账成功的金额,单位为“分”。当批次状态为“PROCESSING”(转账中)时,转账成功金额随时可能变化
|
|
|
|
SuccessNum int `json:"success_num"` // 转账成功笔数
|
|
|
|
SuccessNum int `json:"success_num"` // 转账成功的笔数。当批次状态为“PROCESSING”(转账中)时,转账成功笔数随时可能变化
|
|
|
|
FailAmount int `json:"fail_amount"` // 转账失败金额
|
|
|
|
FailAmount int `json:"fail_amount"` // 转账失败的金额,单位为“分”
|
|
|
|
FailNum int `json:"fail_num"` // 转账失败笔数
|
|
|
|
FailNum int `json:"fail_num"` // 转账失败的笔数
|
|
|
|
} `json:"transfer_batch"` // 转账批次单
|
|
|
|
TransferSceneId string `json:"transfer_scene_id"` // 指定的转账场景ID
|
|
|
|
|
|
|
|
} `json:"transfer_batch"` // 转账批次单基本信息
|
|
|
|
TransferDetailList []struct {
|
|
|
|
TransferDetailList []struct {
|
|
|
|
DetailId string `json:"detail_id"` // 微信明细单号
|
|
|
|
DetailId string `json:"detail_id"` // 微信支付系统内部区分转账批次单下不同转账明细单的唯一标识
|
|
|
|
OutDetailNo string `json:"out_detail_no"` // 商家明细单号
|
|
|
|
OutDetailNo string `json:"out_detail_no"` // 商户系统内部区分转账批次单下不同转账明细单的唯一标识
|
|
|
|
DetailStatus string `json:"detail_status"` // 明细状态
|
|
|
|
DetailStatus string `json:"detail_status"` // INIT: 初始态。 系统转账校验中 WAIT_PAY: 待确认。待商户确认, 符合免密条件时, 系统会自动扭转为转账中 PROCESSING:转账中。正在处理中,转账结果尚未明确 SUCCESS:转账成功 FAIL:转账失败。需要确认失败原因后,再决定是否重新发起对该笔明细单的转账(并非整个转账批次单)
|
|
|
|
} `json:"transfer_detail_list,omitempty"` // 转账明细单列表
|
|
|
|
} `json:"transfer_detail_list,omitempty"` // 当批次状态为“FINISHED”(已完成),且成功查询到转账明细单时返回。包括微信明细单号、明细状态信息
|
|
|
|
Offset int `json:"offset"` // 请求资源起始位置
|
|
|
|
|
|
|
|
Limit int `json:"limit"` // 最大资源条数
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
type TransferBatchesOutBatchNoResult struct {
|
|
|
|
type TransferBatchesOutBatchNoResult struct {
|
|
|
@ -47,20 +46,13 @@ func newTransferBatchesOutBatchNoResult(result TransferBatchesOutBatchNoResponse
|
|
|
|
return &TransferBatchesOutBatchNoResult{Result: result, Body: body, Http: http, Err: err}
|
|
|
|
return &TransferBatchesOutBatchNoResult{Result: result, Body: body, Http: http, Err: err}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// TransferBatchesOutBatchNo 商家批次单号查询批次单API
|
|
|
|
// TransferBatchesOutBatchNo 通过微信批次单号查询批次单
|
|
|
|
// https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter4_3_5.shtml
|
|
|
|
// https://pay.weixin.qq.com/docs/merchant/apis/batch-transfer-to-balance/transfer-batch/get-transfer-batch-by-no.html
|
|
|
|
func (c *Client) TransferBatchesOutBatchNo(ctx context.Context, outBatchNo string, needQueryDetail bool, offset, limit int, detailStatus string) *TransferBatchesOutBatchNoResult {
|
|
|
|
func (c *Client) TransferBatchesOutBatchNo(ctx context.Context, notMustParams ...gorequest.Params) *TransferBatchesOutBatchNoResult {
|
|
|
|
// 参数
|
|
|
|
// 参数
|
|
|
|
params := gorequest.NewParams()
|
|
|
|
params := gorequest.NewParamsWith(notMustParams...)
|
|
|
|
params.Set("out_batch_no", outBatchNo)
|
|
|
|
|
|
|
|
params.Set("need_query_detail", needQueryDetail)
|
|
|
|
|
|
|
|
params.Set("offset", offset)
|
|
|
|
|
|
|
|
params.Set("limit", limit)
|
|
|
|
|
|
|
|
if needQueryDetail {
|
|
|
|
|
|
|
|
params.Set("detail_status", detailStatus)
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
// 请求
|
|
|
|
// 请求
|
|
|
|
request, err := c.request(ctx, apiUrl+"/v3/transfer/batches/out-batch-no/"+outBatchNo, params, http.MethodGet, false)
|
|
|
|
request, err := c.request(ctx, apiUrl+"/v3/transfer/batches/out-batch-no", params, http.MethodGet, false)
|
|
|
|
if err != nil {
|
|
|
|
if err != nil {
|
|
|
|
return newTransferBatchesOutBatchNoResult(TransferBatchesOutBatchNoResponse{}, request.ResponseBody, request, err)
|
|
|
|
return newTransferBatchesOutBatchNoResult(TransferBatchesOutBatchNoResponse{}, request.ResponseBody, request, err)
|
|
|
|
}
|
|
|
|
}
|
|
|
|