1 Star 0 Fork 0

李.斯科特/gopay

Create your Gitee Account
Explore and code with more than 14 million developers,Free private repositories !:)
Sign up
文件
Clone or Download
goods_api.go 1.10 KB
Copy Edit Raw Blame History
LeeScott authored 2023-03-14 16:59 +08:00 . github-gitee
package alipay
import (
"context"
"encoding/json"
"fmt"
"gitee.com/LeeScott/gopay"
"gitee.com/LeeScott/gopay/pkg/util"
)
// alipay.merchant.item.file.upload(商品文件上传接口)
// 文档地址:https://opendocs.alipay.com/apis/api_4/alipay.merchant.item.file.upload
func (a *Client) MerchantItemFileUpload(ctx context.Context, file *util.File) (aliRsp *MerchantItemFileUploadRsp, err error) {
bm := make(gopay.BodyMap)
bm.Set("scene", "SYNC_ORDER") //素材固定值
var bs []byte
if bs, err = a.FileRequest(ctx, bm, file, "alipay.merchant.item.file.upload"); err != nil {
return nil, err
}
aliRsp = new(MerchantItemFileUploadRsp)
if err = json.Unmarshal(bs, aliRsp); err != nil {
return nil, err
}
if aliRsp.Response != nil && aliRsp.Response.Code != "10000" {
info := aliRsp.Response
return aliRsp, fmt.Errorf(`{"code":"%s","msg":"%s","sub_code":"%s","sub_msg":"%s"}`, info.Code, info.Msg, info.SubCode, info.SubMsg)
}
signData, signDataErr := a.getSignData(bs, aliRsp.AlipayCertSn)
aliRsp.SignData = signData
return aliRsp, a.autoVerifySignByCert(aliRsp.Sign, signData, signDataErr)
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Go
1
https://gitee.com/LeeScott/gopay.git
git@gitee.com:LeeScott/gopay.git
LeeScott
gopay
gopay
v1.5.93

Search