From 91a71ef339585af049ad3e2604dda32d01ee3cac Mon Sep 17 00:00:00 2001 From: jiangyong27 Date: Mon, 18 Nov 2024 16:18:22 +0800 Subject: [PATCH] GetPartner --- unify/pay.go | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) 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")