diff --git a/unify/pay.go b/unify/pay.go index 1f6756b..40e772a 100644 --- a/unify/pay.go +++ b/unify/pay.go @@ -151,6 +151,26 @@ func (p *Pay) GetPartnerOrder(outTradeNo string) (map[string]interface{}, error) 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 { if req.OutTradeNo == "" { errors.New("outTradeNo is nil")