refund fee2

This commit is contained in:
jiangyong27 2024-11-04 14:45:46 +08:00
parent 5e155e8e45
commit 13d8012c89
2 changed files with 5 additions and 5 deletions

View File

@ -151,7 +151,7 @@ func (p *Pay) GetPartnerOrder(outTradeNo string) (map[string]interface{}, error)
return rsp.Data, nil return rsp.Data, nil
} }
func (p *Pay) RefundOrder(req *RefundPartnerOrderReq) error { func (p *Pay) RefundOrder(req *RefundOrderReq) error {
if req.OutTradeNo == "" { if req.OutTradeNo == "" {
errors.New("outTradeNo is nil") errors.New("outTradeNo is nil")
} }
@ -175,12 +175,12 @@ func (p *Pay) RefundOrder(req *RefundPartnerOrderReq) error {
return nil return nil
} }
func (p *Pay) RefundPartnerOrder(outTradeNo, reason string) error { func (p *Pay) RefundPartnerOrder(req *RefundOrderReq) error {
if outTradeNo == "" { if req.OutTradeNo == "" {
errors.New("outTradeNo is nil") errors.New("outTradeNo is nil")
} }
reqUrl := fmt.Sprintf("%s/api/pay/partner/order?outTradeNo=%s&reason=%s", p.address, outTradeNo, reason) reqUrl := fmt.Sprintf("%s/api/pay/partner/order?outTradeNo=%s&reason=%s&refundFee=%d", p.address, req.OutTradeNo, req.Reason, req.RefundFee)
result, err := util.HttpDelete(reqUrl, map[string]string{ result, err := util.HttpDelete(reqUrl, map[string]string{
"x-token": p.token, "x-token": p.token,
}) })

View File

@ -44,7 +44,7 @@ type CreatePartnerOrderReq struct {
Extra interface{} `json:"extra"` Extra interface{} `json:"extra"`
} }
type RefundPartnerOrderReq struct { type RefundOrderReq struct {
OutTradeNo string `json:"outTradeNo"` OutTradeNo string `json:"outTradeNo"`
Reason string `json:"reason,omitempty"` Reason string `json:"reason,omitempty"`
RefundFee int64 `json:"refundFee,omitempty"` RefundFee int64 `json:"refundFee,omitempty"`