记录退款失败请求参数
This commit is contained in:
@@ -146,6 +146,7 @@ type QueryRefundResponse struct {
|
||||
RefundAmount string
|
||||
RefundTime string
|
||||
Raw map[string]string
|
||||
RawRequest map[string]string
|
||||
}
|
||||
|
||||
type VerifyNotifyResult struct {
|
||||
@@ -275,7 +276,14 @@ func (c *Client) CreateRefund(ctx context.Context, req CreateRefundRequest) (*Cr
|
||||
rawReq := stringifyMap(reqData)
|
||||
raw, err := c.post(ctx, endpointRefund, reqData)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
return &CreateRefundResponse{
|
||||
MerchantID: c.cfg.MerchantID,
|
||||
ThirdOrderID: req.ThirdOrderID,
|
||||
ProviderOrderID: req.ProviderOrderID,
|
||||
MerchantRefundID: req.MerchantRefundID,
|
||||
RefundAmount: strconv.FormatInt(req.RefundAmountCent, 10),
|
||||
RawRequest: rawReq,
|
||||
}, err
|
||||
}
|
||||
return &CreateRefundResponse{
|
||||
OK: responseOK(raw),
|
||||
@@ -312,9 +320,17 @@ func (c *Client) QueryRefund(ctx context.Context, req QueryRefundRequest) (*Quer
|
||||
if c.cfg.TermNo == "" {
|
||||
delete(reqData, "term_no")
|
||||
}
|
||||
rawReq := stringifyMap(reqData)
|
||||
raw, err := c.post(ctx, endpointRefundQuery, reqData)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
return &QueryRefundResponse{
|
||||
MerchantID: c.cfg.MerchantID,
|
||||
ThirdOrderID: req.ThirdOrderID,
|
||||
ProviderOrderID: req.ProviderOrderID,
|
||||
MerchantRefundID: req.MerchantRefundID,
|
||||
ProviderRefundID: req.ProviderRefundID,
|
||||
RawRequest: rawReq,
|
||||
}, err
|
||||
}
|
||||
return &QueryRefundResponse{
|
||||
OK: responseOK(raw),
|
||||
@@ -328,6 +344,7 @@ func (c *Client) QueryRefund(ctx context.Context, req QueryRefundRequest) (*Quer
|
||||
RefundAmount: raw["refund_amount"],
|
||||
RefundTime: firstNonEmpty(raw["refund_time"], raw["trade_time"], raw["finish_time"]),
|
||||
Raw: raw,
|
||||
RawRequest: rawReq,
|
||||
}, nil
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user