GetPartner

This commit is contained in:
jiangyong27 2024-11-18 16:18:22 +08:00
parent 9e81803b54
commit 91a71ef339
1 changed files with 20 additions and 0 deletions

View File

@ -151,6 +151,26 @@ func (p *Pay) GetPartnerOrder(outTradeNo string) (map[string]interface{}, error)
return rsp.Data, nil return rsp.Data, nil
} }
func (p *Pay) GetPartner(id int64) (map[string]interface{}, error) {
reqUrl := fmt.Sprintf("%s/api/pay/partner?id=%d", p.address, id)
result, err := util.HttpGet(reqUrl, map[string]string{
"x-token": p.token,
})
if err != nil {
return nil, err
}
var rsp CommonResponse
if err := json.Unmarshal([]byte(result), &rsp); err != nil {
return nil, err
}
if rsp.Code != 0 {
return nil, fmt.Errorf("%d:%s", rsp.Code, rsp.Message)
}
return rsp.Data, nil
}
func (p *Pay) RefundOrder(req *RefundOrderReq) error { func (p *Pay) RefundOrder(req *RefundOrderReq) error {
if req.OutTradeNo == "" { if req.OutTradeNo == "" {
errors.New("outTradeNo is nil") errors.New("outTradeNo is nil")