refund fee
This commit is contained in:
parent
b83f06ac8a
commit
5e155e8e45
|
@ -151,12 +151,12 @@ func (p *Pay) GetPartnerOrder(outTradeNo string) (map[string]interface{}, error)
|
||||||
return rsp.Data, nil
|
return rsp.Data, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (p *Pay) RefundOrder(outTradeNo, reason string) error {
|
func (p *Pay) RefundOrder(req *RefundPartnerOrderReq) error {
|
||||||
if outTradeNo == "" {
|
if req.OutTradeNo == "" {
|
||||||
errors.New("outTradeNo is nil")
|
errors.New("outTradeNo is nil")
|
||||||
}
|
}
|
||||||
|
|
||||||
reqUrl := fmt.Sprintf("%s/api/pay/order?outTradeNo=%s&reason=%s", p.address, outTradeNo, reason)
|
reqUrl := fmt.Sprintf("%s/api/pay/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,
|
||||||
})
|
})
|
||||||
|
|
|
@ -44,6 +44,12 @@ type CreatePartnerOrderReq struct {
|
||||||
Extra interface{} `json:"extra"`
|
Extra interface{} `json:"extra"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type RefundPartnerOrderReq struct {
|
||||||
|
OutTradeNo string `json:"outTradeNo"`
|
||||||
|
Reason string `json:"reason,omitempty"`
|
||||||
|
RefundFee int64 `json:"refundFee,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
type CommonResponse struct {
|
type CommonResponse struct {
|
||||||
Code int `json:"code"`
|
Code int `json:"code"`
|
||||||
Message string `json:"message"`
|
Message string `json:"message"`
|
||||||
|
|
Loading…
Reference in New Issue