parent
c22e2ce46e
commit
1ee569b43a
@ -0,0 +1,69 @@
|
||||
package wechatpayapiv2
|
||||
|
||||
import (
|
||||
"context"
|
||||
"encoding/xml"
|
||||
"github.com/dtapps/go-library/utils/gorandom"
|
||||
"github.com/dtapps/go-library/utils/gorequest"
|
||||
)
|
||||
|
||||
type MmpaymkttransfersGethbinfoResponse struct {
|
||||
ReturnCode string `json:"return_code" xml:"return_code"` // 返回状态码
|
||||
ReturnMsg string `json:"return_msg,omitempty" xml:"return_msg,omitempty"` // 返回信息
|
||||
|
||||
ResultCode string `json:"result_code" xml:"result_code"` // 业务结果
|
||||
ErrCode string `json:"err_code,omitempty" xml:"err_code,omitempty"` // 错误代码
|
||||
ErrCodeDes string `json:"err_code_des,omitempty" xml:"err_code_des,omitempty"` // 错误代码描述
|
||||
|
||||
MchBillno string `json:"mch_billno" xml:"mch_billno"` // 商户订单号
|
||||
MchId string `json:"mch_id" xml:"mch_id"` // 商户号
|
||||
DetailId string `json:"detail_id" xml:"detail_id"` // 红包单号
|
||||
Status string `json:"status" xml:"status"` // 红包状态
|
||||
SendType string `json:"send_type" xml:"send_type"` // 发放类型
|
||||
HbType string `json:"hb_type" xml:"hb_type"` // 红包类型
|
||||
TotalNum int64 `json:"total_num" xml:"total_num"` // 红包个数
|
||||
TotalAmount int64 `json:"total_amount" xml:"total_amount"` // 红包金额
|
||||
Reason string `json:"reason" xml:"reason"` // 失败原因
|
||||
SendTime string `json:"send_time" xml:"send_time"` // 红包发送时间
|
||||
RefundTime string `json:"refund_time" xml:"refund_time"` // 红包退款时间
|
||||
RefundAmount int64 `json:"refund_amount" xml:"refund_amount"` // 红包退款金额
|
||||
Wishing string `json:"wishing" xml:"wishing"` // 祝福语
|
||||
Remark string `json:"remark" xml:"remark"` // 活动描述
|
||||
ActName string `json:"act_name" xml:"act_name"` // 活动名称
|
||||
Hblist []struct {
|
||||
Openid string `json:"openid" xml:"openid"` // 领取红包的Openid
|
||||
Amount int64 `json:"amount" xml:"amount"` // 金额
|
||||
Rcv_time string `json:"rcv_time" xml:"rcv_time"` // 接收时间
|
||||
} `json:"hblist" xml:"hblist"` // 裂变红包领取列表
|
||||
}
|
||||
|
||||
type MmpaymkttransfersGethbinfoResult struct {
|
||||
Result MmpaymkttransfersGethbinfoResponse // 结果
|
||||
Body []byte // 内容
|
||||
Http gorequest.Response // 请求
|
||||
}
|
||||
|
||||
func newMmpaymkttransfersGethbinfoResult(result MmpaymkttransfersGethbinfoResponse, body []byte, http gorequest.Response) *MmpaymkttransfersGethbinfoResult {
|
||||
return &MmpaymkttransfersGethbinfoResult{Result: result, Body: body, Http: http}
|
||||
}
|
||||
|
||||
// MmpaymkttransfersGethbinfo
|
||||
// 付款到零钱 - 查询红包记录
|
||||
// https://pay.weixin.qq.com/wiki/doc/api/tools/cash_coupon_sl.php?chapter=13_6&index=5
|
||||
func (c *Client) MmpaymkttransfersGethbinfo(ctx context.Context, notMustParams ...gorequest.Params) (*MmpaymkttransfersGethbinfoResult, error) {
|
||||
cert, err := c.P12ToPem()
|
||||
// 参数
|
||||
params := gorequest.NewParamsWith(notMustParams...)
|
||||
params.Set("nonce_str", gorandom.Alphanumeric(32)) // 随机字符串
|
||||
// 签名
|
||||
params.Set("sign", c.getMd5Sign(params))
|
||||
// 请求
|
||||
request, err := c.request(ctx, apiUrl+"/mmpaymkttransfers/sendgroupredpack", params, true, cert)
|
||||
if err != nil {
|
||||
return newMmpaymkttransfersGethbinfoResult(MmpaymkttransfersGethbinfoResponse{}, request.ResponseBody, request), err
|
||||
}
|
||||
// 定义
|
||||
var response MmpaymkttransfersGethbinfoResponse
|
||||
err = xml.Unmarshal(request.ResponseBody, &response)
|
||||
return newMmpaymkttransfersGethbinfoResult(response, request.ResponseBody, request), err
|
||||
}
|
@ -0,0 +1,55 @@
|
||||
package wechatpayapiv2
|
||||
|
||||
import (
|
||||
"context"
|
||||
"encoding/xml"
|
||||
"github.com/dtapps/go-library/utils/gorandom"
|
||||
"github.com/dtapps/go-library/utils/gorequest"
|
||||
)
|
||||
|
||||
type MmpaymkttransfersSendgroupredpackResponse struct {
|
||||
ReturnCode string `json:"return_code" xml:"return_code"` // 返回状态码
|
||||
ReturnMsg string `json:"return_msg,omitempty" xml:"return_msg,omitempty"` // 返回信息
|
||||
|
||||
ResultCode string `json:"result_code" xml:"result_code"` // 业务结果
|
||||
ErrCode string `json:"err_code,omitempty" xml:"err_code,omitempty"` // 错误代码
|
||||
ErrCodeDes string `json:"err_code_des,omitempty" xml:"err_code_des,omitempty"` // 错误代码描述
|
||||
|
||||
MchBillno string `json:"mch_billno" xml:"mch_billno"` // 商户订单号
|
||||
MchId string `json:"mch_id" xml:"mch_id"` // 商户号
|
||||
Wxappid string `json:"wxappid" xml:"wxappid"` // 公众账号appid
|
||||
ReOpenid string `json:"re_openid" xml:"re_openid"` // 用户openid
|
||||
TotalAmount int64 `json:"total_amount" xml:"total_amount"` // 付款金额
|
||||
SendListid string `json:"send_listid" xml:"send_listid"` // 微信单号
|
||||
}
|
||||
|
||||
type MmpaymkttransfersSendgroupredpackResult struct {
|
||||
Result MmpaymkttransfersSendgroupredpackResponse // 结果
|
||||
Body []byte // 内容
|
||||
Http gorequest.Response // 请求
|
||||
}
|
||||
|
||||
func newMmpaymkttransfersSendgroupredpackResult(result MmpaymkttransfersSendgroupredpackResponse, body []byte, http gorequest.Response) *MmpaymkttransfersSendgroupredpackResult {
|
||||
return &MmpaymkttransfersSendgroupredpackResult{Result: result, Body: body, Http: http}
|
||||
}
|
||||
|
||||
// MmpaymkttransfersSendgroupredpack
|
||||
// 付款到零钱 - 发放裂变红包
|
||||
// https://pay.weixin.qq.com/wiki/doc/api/tools/cash_coupon_sl.php?chapter=13_5&index=4
|
||||
func (c *Client) MmpaymkttransfersSendgroupredpack(ctx context.Context, notMustParams ...gorequest.Params) (*MmpaymkttransfersSendgroupredpackResult, error) {
|
||||
cert, err := c.P12ToPem()
|
||||
// 参数
|
||||
params := gorequest.NewParamsWith(notMustParams...)
|
||||
params.Set("nonce_str", gorandom.Alphanumeric(32)) // 随机字符串
|
||||
// 签名
|
||||
params.Set("sign", c.getMd5Sign(params))
|
||||
// 请求
|
||||
request, err := c.request(ctx, apiUrl+"/mmpaymkttransfers/sendgroupredpack", params, true, cert)
|
||||
if err != nil {
|
||||
return newMmpaymkttransfersSendgroupredpackResult(MmpaymkttransfersSendgroupredpackResponse{}, request.ResponseBody, request), err
|
||||
}
|
||||
// 定义
|
||||
var response MmpaymkttransfersSendgroupredpackResponse
|
||||
err = xml.Unmarshal(request.ResponseBody, &response)
|
||||
return newMmpaymkttransfersSendgroupredpackResult(response, request.ResponseBody, request), err
|
||||
}
|
@ -0,0 +1,55 @@
|
||||
package wechatpayapiv2
|
||||
|
||||
import (
|
||||
"context"
|
||||
"encoding/xml"
|
||||
"github.com/dtapps/go-library/utils/gorandom"
|
||||
"github.com/dtapps/go-library/utils/gorequest"
|
||||
)
|
||||
|
||||
type MmpaymkttransfersSendredpackResponse struct {
|
||||
ReturnCode string `json:"return_code" xml:"return_code"` // 返回状态码
|
||||
ReturnMsg string `json:"return_msg,omitempty" xml:"return_msg,omitempty"` // 返回信息
|
||||
|
||||
ResultCode string `json:"result_code" xml:"result_code"` // 业务结果
|
||||
ErrCode string `json:"err_code,omitempty" xml:"err_code,omitempty"` // 错误代码
|
||||
ErrCodeDes string `json:"err_code_des,omitempty" xml:"err_code_des,omitempty"` // 错误代码描述
|
||||
|
||||
MchBillno string `json:"mch_billno" xml:"mch_billno"` // 商户订单号
|
||||
MchId string `json:"mch_id" xml:"mch_id"` // 商户号
|
||||
Wxappid string `json:"wxappid" xml:"wxappid"` // 公众账号appid
|
||||
ReOpenid string `json:"re_openid" xml:"re_openid"` // 用户openid
|
||||
TotalAmount int64 `json:"total_amount" xml:"total_amount"` // 付款金额
|
||||
SendListid string `json:"send_listid" xml:"send_listid"` // 微信单号
|
||||
}
|
||||
|
||||
type MmpaymkttransfersSendredpackResult struct {
|
||||
Result MmpaymkttransfersSendredpackResponse // 结果
|
||||
Body []byte // 内容
|
||||
Http gorequest.Response // 请求
|
||||
}
|
||||
|
||||
func newMmpaymkttransfersSendredpackResult(result MmpaymkttransfersSendredpackResponse, body []byte, http gorequest.Response) *MmpaymkttransfersSendredpackResult {
|
||||
return &MmpaymkttransfersSendredpackResult{Result: result, Body: body, Http: http}
|
||||
}
|
||||
|
||||
// MmpaymkttransfersSendredpack
|
||||
// 付款到零钱 - 发放普通红包
|
||||
// https://pay.weixin.qq.com/wiki/doc/api/tools/cash_coupon_sl.php?chapter=13_4&index=3
|
||||
func (c *Client) MmpaymkttransfersSendredpack(ctx context.Context, notMustParams ...gorequest.Params) (*MmpaymkttransfersSendredpackResult, error) {
|
||||
cert, err := c.P12ToPem()
|
||||
// 参数
|
||||
params := gorequest.NewParamsWith(notMustParams...)
|
||||
params.Set("nonce_str", gorandom.Alphanumeric(32)) // 随机字符串
|
||||
// 签名
|
||||
params.Set("sign", c.getMd5Sign(params))
|
||||
// 请求
|
||||
request, err := c.request(ctx, apiUrl+"/mmpaymkttransfers/sendredpack", params, true, cert)
|
||||
if err != nil {
|
||||
return newMmpaymkttransfersSendredpackResult(MmpaymkttransfersSendredpackResponse{}, request.ResponseBody, request), err
|
||||
}
|
||||
// 定义
|
||||
var response MmpaymkttransfersSendredpackResponse
|
||||
err = xml.Unmarshal(request.ResponseBody, &response)
|
||||
return newMmpaymkttransfersSendredpackResult(response, request.ResponseBody, request), err
|
||||
}
|
Binary file not shown.
Before Width: | Height: | Size: 68 MiB After Width: | Height: | Size: 68 MiB |
Binary file not shown.
Loading…
Reference in new issue