query escape

This commit is contained in:
jiangyong27 2025-03-12 17:49:14 +08:00
parent 55aa6f3214
commit c3a37fafc9
1 changed files with 3 additions and 2 deletions

View File

@ -5,6 +5,7 @@ import (
"errors"
"fmt"
"git.u8t.cn/open/gosdk/util"
"net/url"
)
var (
@ -176,7 +177,7 @@ func (p *Pay) RefundOrder(req *RefundOrderReq) error {
errors.New("outTradeNo is nil")
}
reqUrl := fmt.Sprintf("%s/api/pay/order?outTradeNo=%s&reason=%s&refundFee=%d", p.address, req.OutTradeNo, req.Reason, req.RefundFee)
reqUrl := fmt.Sprintf("%s/api/pay/order?outTradeNo=%s&reason=%s&refundFee=%d", p.address, req.OutTradeNo, url.QueryEscape(req.Reason), req.RefundFee)
result, err := util.HttpDelete(reqUrl, map[string]string{
"x-token": p.token,
})
@ -200,7 +201,7 @@ func (p *Pay) RefundPartnerOrder(req *RefundOrderReq) error {
errors.New("outTradeNo is nil")
}
reqUrl := fmt.Sprintf("%s/api/pay/partner/order?outTradeNo=%s&reason=%s&refundFee=%d", p.address, req.OutTradeNo, req.Reason, req.RefundFee)
reqUrl := fmt.Sprintf("%s/api/pay/partner/order?outTradeNo=%s&reason=%s&refundFee=%d", p.address, req.OutTradeNo, url.QueryEscape(req.Reason), req.RefundFee)
result, err := util.HttpDelete(reqUrl, map[string]string{
"x-token": p.token,
})