mirror of
https://github.com/silenceper/wechat.git
synced 2026-11-16 05:12:03 +08:00
feat(virtualpayment): 虚拟支付对齐微信最新api接口文档 (#885)
* fix typo * feat(virtualpayment): ✨ 添加广告金相关接口及错误码 - 新增批量任务、退款、广告金充值等相关错误码 - 添加下载订单、查询商家账户余额、查询广告金发放记录等接口 - 实现投诉处理相关接口,包括获取投诉列表、投诉详情、协商历史等 - 完善上传媒体文件及获取签名头部的功能 * feat(virtualpayment): ✨ 优化请求地址组合逻辑,合并多个 case 语句 * 补充虚拟支付道具发货拼团字段 * fix(virtualpayment): 🐛 修正退款错误码注释拼写和商户订单号字段名称 * feat(virtualpayment): ✨ 添加 iOS Apple 支付退款问询事件及相关数据结构 * feat(virtualpayment): ✨ 优化 iOS Apple 支付退款问询事件的注释格式
This commit is contained in:
4 files changed
+1102
-15
No files matched your search
@@ -439,6 +439,499 @@ func (s *VirtualPayment) QueryPublishGoods(ctx context.Context, in *QueryPublish
|
||||
return
|
||||
}
|
||||
|
||||
// StartDownloadOrder 发起下载小程序订单明细任务
|
||||
func (s *VirtualPayment) StartDownloadOrder(ctx context.Context, in *StartDownloadOrderRequest) (out StartDownloadOrderResponse, err error) {
|
||||
var jsonByte []byte
|
||||
if jsonByte, err = json.Marshal(in); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
var (
|
||||
params = URLParams{
|
||||
Path: startDownloadOrder,
|
||||
Content: string(jsonByte),
|
||||
Signature: EmptyString,
|
||||
}
|
||||
address string
|
||||
)
|
||||
if address, err = s.requestAddress(params); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
var response []byte
|
||||
if response, err = util.PostJSONContext(ctx, address, in); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
// 使用通用方法返回错误
|
||||
err = util.DecodeWithError(response, &out, "StartDownloadOrder")
|
||||
return
|
||||
}
|
||||
|
||||
// QueryDownloadOrder 查询下载订单任务结果
|
||||
func (s *VirtualPayment) QueryDownloadOrder(ctx context.Context, in *QueryDownloadOrderRequest) (out QueryDownloadOrderResponse, err error) {
|
||||
var jsonByte []byte
|
||||
if jsonByte, err = json.Marshal(in); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
var (
|
||||
params = URLParams{
|
||||
Path: queryDownloadOrder,
|
||||
Content: string(jsonByte),
|
||||
Signature: EmptyString,
|
||||
}
|
||||
address string
|
||||
)
|
||||
if address, err = s.requestAddress(params); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
var response []byte
|
||||
if response, err = util.PostJSONContext(ctx, address, in); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
// 使用通用方法返回错误
|
||||
err = util.DecodeWithError(response, &out, "QueryDownloadOrder")
|
||||
return
|
||||
}
|
||||
|
||||
// QueryBizBalance 查询商家账户可提现余额
|
||||
func (s *VirtualPayment) QueryBizBalance(ctx context.Context, in *QueryBizBalanceRequest) (out QueryBizBalanceResponse, err error) {
|
||||
var jsonByte []byte
|
||||
if jsonByte, err = json.Marshal(in); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
var (
|
||||
params = URLParams{
|
||||
Path: queryBizBalance,
|
||||
Content: string(jsonByte),
|
||||
Signature: EmptyString,
|
||||
}
|
||||
address string
|
||||
)
|
||||
if address, err = s.requestAddress(params); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
var response []byte
|
||||
if response, err = util.PostJSONContext(ctx, address, in); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
// 使用通用方法返回错误
|
||||
err = util.DecodeWithError(response, &out, "QueryBizBalance")
|
||||
return
|
||||
}
|
||||
|
||||
// QueryTransferAccount 查询广告金充值账户
|
||||
func (s *VirtualPayment) QueryTransferAccount(ctx context.Context, in *QueryTransferAccountRequest) (out QueryTransferAccountResponse, err error) {
|
||||
var jsonByte []byte
|
||||
if jsonByte, err = json.Marshal(in); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
var (
|
||||
params = URLParams{
|
||||
Path: queryTransferAccount,
|
||||
Content: string(jsonByte),
|
||||
Signature: EmptyString,
|
||||
}
|
||||
address string
|
||||
)
|
||||
if address, err = s.requestAddress(params); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
var response []byte
|
||||
if response, err = util.PostJSONContext(ctx, address, in); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
// 使用通用方法返回错误
|
||||
err = util.DecodeWithError(response, &out, "QueryTransferAccount")
|
||||
return
|
||||
}
|
||||
|
||||
// QueryAdverFunds 查询广告金发放记录
|
||||
func (s *VirtualPayment) QueryAdverFunds(ctx context.Context, in *QueryAdverFundsRequest) (out QueryAdverFundsResponse, err error) {
|
||||
var jsonByte []byte
|
||||
if jsonByte, err = json.Marshal(in); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
var (
|
||||
params = URLParams{
|
||||
Path: queryAdverFunds,
|
||||
Content: string(jsonByte),
|
||||
Signature: EmptyString,
|
||||
}
|
||||
address string
|
||||
)
|
||||
if address, err = s.requestAddress(params); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
var response []byte
|
||||
if response, err = util.PostJSONContext(ctx, address, in); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
// 使用通用方法返回错误
|
||||
err = util.DecodeWithError(response, &out, "QueryAdverFunds")
|
||||
return
|
||||
}
|
||||
|
||||
// CreateFundsBill 充值广告金
|
||||
func (s *VirtualPayment) CreateFundsBill(ctx context.Context, in *CreateFundsBillRequest) (out CreateFundsBillResponse, err error) {
|
||||
var jsonByte []byte
|
||||
if jsonByte, err = json.Marshal(in); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
var (
|
||||
params = URLParams{
|
||||
Path: createFundsBill,
|
||||
Content: string(jsonByte),
|
||||
Signature: EmptyString,
|
||||
}
|
||||
address string
|
||||
)
|
||||
if address, err = s.requestAddress(params); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
var response []byte
|
||||
if response, err = util.PostJSONContext(ctx, address, in); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
// 使用通用方法返回错误
|
||||
err = util.DecodeWithError(response, &out, "CreateFundsBill")
|
||||
return
|
||||
}
|
||||
|
||||
// BindTransferAccount 绑定广告金充值账户
|
||||
func (s *VirtualPayment) BindTransferAccount(ctx context.Context, in *BindTransferAccountRequest) (out BindTransferAccountResponse, err error) {
|
||||
var jsonByte []byte
|
||||
if jsonByte, err = json.Marshal(in); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
var (
|
||||
params = URLParams{
|
||||
Path: bindTransferAccount,
|
||||
Content: string(jsonByte),
|
||||
Signature: EmptyString,
|
||||
}
|
||||
address string
|
||||
)
|
||||
if address, err = s.requestAddress(params); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
var response []byte
|
||||
if response, err = util.PostJSONContext(ctx, address, in); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
// 使用通用方法返回错误
|
||||
err = util.DecodeWithError(response, &out, "BindTransferAccount")
|
||||
return
|
||||
}
|
||||
|
||||
// QueryFundsBill 查询广告金充值记录
|
||||
func (s *VirtualPayment) QueryFundsBill(ctx context.Context, in *QueryFundsBillRequest) (out QueryFundsBillResponse, err error) {
|
||||
var jsonByte []byte
|
||||
if jsonByte, err = json.Marshal(in); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
var (
|
||||
params = URLParams{
|
||||
Path: queryFundsBill,
|
||||
Content: string(jsonByte),
|
||||
Signature: EmptyString,
|
||||
}
|
||||
address string
|
||||
)
|
||||
if address, err = s.requestAddress(params); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
var response []byte
|
||||
if response, err = util.PostJSONContext(ctx, address, in); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
// 使用通用方法返回错误
|
||||
err = util.DecodeWithError(response, &out, "QueryFundsBill")
|
||||
return
|
||||
}
|
||||
|
||||
// QueryRecoverBill 查询广告金回收记录
|
||||
func (s *VirtualPayment) QueryRecoverBill(ctx context.Context, in *QueryRecoverBillRequest) (out QueryRecoverBillResponse, err error) {
|
||||
var jsonByte []byte
|
||||
if jsonByte, err = json.Marshal(in); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
var (
|
||||
params = URLParams{
|
||||
Path: queryRecoverBill,
|
||||
Content: string(jsonByte),
|
||||
Signature: EmptyString,
|
||||
}
|
||||
address string
|
||||
)
|
||||
if address, err = s.requestAddress(params); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
var response []byte
|
||||
if response, err = util.PostJSONContext(ctx, address, in); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
// 使用通用方法返回错误
|
||||
err = util.DecodeWithError(response, &out, "QueryRecoverBill")
|
||||
return
|
||||
}
|
||||
|
||||
// DownloadAdverFundsOrder 下载广告金对应的商户订单信息
|
||||
func (s *VirtualPayment) DownloadAdverFundsOrder(ctx context.Context, in *DownloadAdverFundsOrderRequest) (out DownloadAdverFundsOrderResponse, err error) {
|
||||
var jsonByte []byte
|
||||
if jsonByte, err = json.Marshal(in); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
var (
|
||||
params = URLParams{
|
||||
Path: downloadAdverFundsOrder,
|
||||
Content: string(jsonByte),
|
||||
Signature: EmptyString,
|
||||
}
|
||||
address string
|
||||
)
|
||||
if address, err = s.requestAddress(params); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
var response []byte
|
||||
if response, err = util.PostJSONContext(ctx, address, in); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
// 使用通用方法返回错误
|
||||
err = util.DecodeWithError(response, &out, "DownloadAdverFundsOrder")
|
||||
return
|
||||
}
|
||||
|
||||
// GetComplaintList 获取投诉列表
|
||||
func (s *VirtualPayment) GetComplaintList(ctx context.Context, in *GetComplaintListRequest) (out GetComplaintListResponse, err error) {
|
||||
var jsonByte []byte
|
||||
if jsonByte, err = json.Marshal(in); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
var (
|
||||
params = URLParams{
|
||||
Path: getComplaintList,
|
||||
Content: string(jsonByte),
|
||||
Signature: EmptyString,
|
||||
}
|
||||
address string
|
||||
)
|
||||
if address, err = s.requestAddress(params); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
var response []byte
|
||||
if response, err = util.PostJSONContext(ctx, address, in); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
// 使用通用方法返回错误
|
||||
err = util.DecodeWithError(response, &out, "GetComplaintList")
|
||||
return
|
||||
}
|
||||
|
||||
// GetComplaintDetail 获取投诉详情
|
||||
func (s *VirtualPayment) GetComplaintDetail(ctx context.Context, in *GetComplaintDetailRequest) (out GetComplaintDetailResponse, err error) {
|
||||
var jsonByte []byte
|
||||
if jsonByte, err = json.Marshal(in); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
var (
|
||||
params = URLParams{
|
||||
Path: getComplaintDetail,
|
||||
Content: string(jsonByte),
|
||||
Signature: EmptyString,
|
||||
}
|
||||
address string
|
||||
)
|
||||
if address, err = s.requestAddress(params); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
var response []byte
|
||||
if response, err = util.PostJSONContext(ctx, address, in); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
// 使用通用方法返回错误
|
||||
err = util.DecodeWithError(response, &out, "GetComplaintDetail")
|
||||
return
|
||||
}
|
||||
|
||||
// GetNegotiationHistory 获取协商历史
|
||||
func (s *VirtualPayment) GetNegotiationHistory(ctx context.Context, in *GetNegotiationHistoryRequest) (out GetNegotiationHistoryResponse, err error) {
|
||||
var jsonByte []byte
|
||||
if jsonByte, err = json.Marshal(in); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
var (
|
||||
params = URLParams{
|
||||
Path: getNegotiationHistory,
|
||||
Content: string(jsonByte),
|
||||
Signature: EmptyString,
|
||||
}
|
||||
address string
|
||||
)
|
||||
if address, err = s.requestAddress(params); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
var response []byte
|
||||
if response, err = util.PostJSONContext(ctx, address, in); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
// 使用通用方法返回错误
|
||||
err = util.DecodeWithError(response, &out, "GetNegotiationHistory")
|
||||
return
|
||||
}
|
||||
|
||||
// ResponseComplaint 回复用户
|
||||
func (s *VirtualPayment) ResponseComplaint(ctx context.Context, in *ResponseComplaintRequest) (out ResponseComplaintResponse, err error) {
|
||||
var jsonByte []byte
|
||||
if jsonByte, err = json.Marshal(in); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
var (
|
||||
params = URLParams{
|
||||
Path: responseComplaint,
|
||||
Content: string(jsonByte),
|
||||
Signature: EmptyString,
|
||||
}
|
||||
address string
|
||||
)
|
||||
if address, err = s.requestAddress(params); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
var response []byte
|
||||
if response, err = util.PostJSONContext(ctx, address, in); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
// 使用通用方法返回错误
|
||||
err = util.DecodeWithError(response, &out, "ResponseComplaint")
|
||||
return
|
||||
}
|
||||
|
||||
// CompleteComplaint 完成投诉处理
|
||||
func (s *VirtualPayment) CompleteComplaint(ctx context.Context, in *CompleteComplaintRequest) (out CompleteComplaintResponse, err error) {
|
||||
var jsonByte []byte
|
||||
if jsonByte, err = json.Marshal(in); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
var (
|
||||
params = URLParams{
|
||||
Path: completeComplaint,
|
||||
Content: string(jsonByte),
|
||||
Signature: EmptyString,
|
||||
}
|
||||
address string
|
||||
)
|
||||
if address, err = s.requestAddress(params); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
var response []byte
|
||||
if response, err = util.PostJSONContext(ctx, address, in); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
// 使用通用方法返回错误
|
||||
err = util.DecodeWithError(response, &out, "CompleteComplaint")
|
||||
return
|
||||
}
|
||||
|
||||
// UploadVPFile 上传媒体文件
|
||||
func (s *VirtualPayment) UploadVPFile(ctx context.Context, in *UploadVPFileRequest) (out UploadVPFileResponse, err error) {
|
||||
var jsonByte []byte
|
||||
if jsonByte, err = json.Marshal(in); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
var (
|
||||
params = URLParams{
|
||||
Path: uploadVPFile,
|
||||
Content: string(jsonByte),
|
||||
Signature: EmptyString,
|
||||
}
|
||||
address string
|
||||
)
|
||||
if address, err = s.requestAddress(params); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
var response []byte
|
||||
if response, err = util.PostJSONContext(ctx, address, in); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
// 使用通用方法返回错误
|
||||
err = util.DecodeWithError(response, &out, "UploadVPFile")
|
||||
return
|
||||
}
|
||||
|
||||
// GetUploadFileSign 获取微信支付反馈投诉图片的签名头部
|
||||
func (s *VirtualPayment) GetUploadFileSign(ctx context.Context, in *GetUploadFileSignRequest) (out GetUploadFileSignResponse, err error) {
|
||||
var jsonByte []byte
|
||||
if jsonByte, err = json.Marshal(in); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
var (
|
||||
params = URLParams{
|
||||
Path: getUploadFileSign,
|
||||
Content: string(jsonByte),
|
||||
Signature: EmptyString,
|
||||
}
|
||||
address string
|
||||
)
|
||||
if address, err = s.requestAddress(params); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
var response []byte
|
||||
if response, err = util.PostJSONContext(ctx, address, in); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
// 使用通用方法返回错误
|
||||
err = util.DecodeWithError(response, &out, "GetUploadFileSign")
|
||||
return
|
||||
}
|
||||
|
||||
// hmacSha256 hmac sha256
|
||||
func (s *VirtualPayment) hmacSha256(key, data string) string {
|
||||
h := hmac.New(sha256.New, []byte(key))
|
||||
@@ -476,23 +969,17 @@ func (s *VirtualPayment) PaySignature(url, data string) (paySign, signature stri
|
||||
// requestURL .组合 URL
|
||||
func (s *VirtualPayment) requestAddress(params URLParams) (url string, err error) {
|
||||
switch params.Path {
|
||||
case queryUserBalance:
|
||||
case currencyPay:
|
||||
case cancelCurrencyPay:
|
||||
case queryUserBalance, currencyPay, cancelCurrencyPay:
|
||||
if params.PaySign, params.Signature, err = s.PaySignature(params.Path, params.Content); err != nil {
|
||||
return
|
||||
}
|
||||
case queryOrder:
|
||||
case notifyProvideGoods:
|
||||
case presentCurrency:
|
||||
case downloadBill:
|
||||
case refundOrder:
|
||||
case createWithdrawOrder:
|
||||
case queryWithdrawOrder:
|
||||
case startUploadGoods:
|
||||
case queryUploadGoods:
|
||||
case startPublishGoods:
|
||||
case queryPublishGoods:
|
||||
case queryOrder, notifyProvideGoods, presentCurrency, downloadBill, refundOrder,
|
||||
createWithdrawOrder, queryWithdrawOrder, startUploadGoods, queryUploadGoods,
|
||||
startPublishGoods, queryPublishGoods, startDownloadOrder, queryDownloadOrder,
|
||||
queryBizBalance, queryTransferAccount, queryAdverFunds, createFundsBill,
|
||||
bindTransferAccount, queryFundsBill, queryRecoverBill, downloadAdverFundsOrder,
|
||||
getComplaintList, getComplaintDetail, getNegotiationHistory, responseComplaint,
|
||||
completeComplaint, uploadVPFile, getUploadFileSign:
|
||||
if params.PaySign, err = s.PaySign(params.Path, params.Content); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user