<feat>报错内容错误
This commit is contained in:
parent
c15044b862
commit
848ebcc443
|
@ -44,9 +44,9 @@ func Refund(c *gin.Context) {
|
|||
c.Set("OutTradeNo", req.OutTradeNo)
|
||||
|
||||
appCheckInfo := controllers.GetAppCheckInfo(c).(*services.AppCheck)
|
||||
refund := thirdpay.ThirdPayRefund(c.Request.Context(), req, appCheckInfo, c.ClientIP())
|
||||
if refund.PayCode != errorcode.Success {
|
||||
controllers.ApiRes(c, nil, refund.PayCode)
|
||||
refund, errCode := thirdpay.ThirdPayRefund(c.Request.Context(), req, appCheckInfo, c.ClientIP())
|
||||
if errCode != errorcode.Success {
|
||||
controllers.ApiRes(c, nil, errCode)
|
||||
return
|
||||
}
|
||||
data := thirdpay.NewOrdersResp(refund.Order)
|
||||
|
|
|
@ -46,23 +46,26 @@ func ThirdPayInfoCheck(ctx context.Context, payReq *front.PayReqs, appCheck *ser
|
|||
return
|
||||
}
|
||||
|
||||
func ThirdPayRefund(ctx context.Context, refundReq *front.RefundReqs, appCheck *services.AppCheck, ip string) (refund *thirdpay.Pay) {
|
||||
func ThirdPayRefund(ctx context.Context, refundReq *front.RefundReqs, appCheck *services.AppCheck, ip string) (refund *thirdpay.Pay, errorCode int) {
|
||||
var req types.Reqs
|
||||
copier.Copy(&req, refundReq)
|
||||
check := thirdpay.NewPayCheck(&ctx, &req, appCheck, ip)
|
||||
// 校验表单
|
||||
check.CheckPayInfo()
|
||||
if check.CheckCode != errorcode.Success {
|
||||
return
|
||||
return nil, check.CheckCode
|
||||
}
|
||||
check.CheckOrderRefund()
|
||||
if check.CheckCode != errorcode.Success {
|
||||
return
|
||||
return nil, check.CheckCode
|
||||
}
|
||||
refund = thirdpay.NewPayWithPayCheck(check)
|
||||
refund.CreateOrder(common.ORDER_TYPE_REFUND)
|
||||
if refund.PayCode != errorcode.Success {
|
||||
return refund, refund.PayCode
|
||||
}
|
||||
refund.Refund()
|
||||
return
|
||||
return refund, errorcode.Success
|
||||
}
|
||||
|
||||
func ThirdPay(check *thirdpay.PayCheck) (pay *thirdpay.Pay) {
|
||||
|
|
Loading…
Reference in New Issue