Compare commits
No commits in common. "37100eb58991e07e6f61d40c0384da1392f38fea" and "553679efa5849dc955f02c575e0434f867ca8932" have entirely different histories.
37100eb589
...
553679efa5
|
@ -44,16 +44,11 @@ func Refund(c *gin.Context) {
|
|||
c.Set("OutTradeNo", req.OutTradeNo)
|
||||
|
||||
appCheckInfo := controllers.GetAppCheckInfo(c).(*services.AppCheck)
|
||||
check, errCode := thirdpay.ThirdPayRefundCheck(c.Request.Context(), req, appCheckInfo, c.ClientIP())
|
||||
refund, errCode := thirdpay.ThirdPayRefund(c.Request.Context(), req, appCheckInfo, c.ClientIP())
|
||||
if errCode != errorcode.Success {
|
||||
controllers.ApiRes(c, nil, errCode)
|
||||
return
|
||||
}
|
||||
refund, errCode := thirdpay.ThirdPayRefund(check)
|
||||
if errCode != errorcode.Success {
|
||||
controllers.ApiRes(c, nil, errCode, refund.ThirdMsg)
|
||||
return
|
||||
}
|
||||
data := thirdpay.NewOrdersResp(refund.Order)
|
||||
var res front.ApiResponse
|
||||
res.Order = data
|
||||
|
|
|
@ -46,28 +46,21 @@ func ThirdPayInfoCheck(ctx context.Context, payReq *front.PayReqs, appCheck *ser
|
|||
return
|
||||
}
|
||||
|
||||
func ThirdPayRefundCheck(ctx context.Context, refundReq *front.RefundReqs, appCheck *services.AppCheck, ip string) (check *thirdpay.PayCheck, errorCode int) {
|
||||
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 := thirdpay.NewPayCheck(&ctx, &req, appCheck, ip)
|
||||
// 校验表单
|
||||
check.CheckPayInfo()
|
||||
return check, check.CheckCode
|
||||
}
|
||||
|
||||
func ThirdPayRefund(check *thirdpay.PayCheck) (refund *thirdpay.Pay, errorCode int) {
|
||||
|
||||
refund = thirdpay.NewPayWithPayCheck(check)
|
||||
if refund.CheckRefundOrder() {
|
||||
refund.CreateOrder(common.ORDER_TYPE_REFUND)
|
||||
if refund.PayCode != errorcode.Success {
|
||||
return refund, refund.PayCode
|
||||
}
|
||||
if check.CheckCode != errorcode.Success {
|
||||
return nil, check.CheckCode
|
||||
}
|
||||
|
||||
refund.Refund()
|
||||
return refund, refund.PayCode
|
||||
|
||||
check.CheckOrderRefund()
|
||||
if check.CheckCode != errorcode.Success {
|
||||
return nil, check.CheckCode
|
||||
}
|
||||
refund, errorCode = ThirdRefund(check)
|
||||
return
|
||||
}
|
||||
|
||||
func ThirdPay(check *thirdpay.PayCheck) (pay *thirdpay.Pay) {
|
||||
|
@ -83,3 +76,16 @@ func ThirdPay(check *thirdpay.PayCheck) (pay *thirdpay.Pay) {
|
|||
}
|
||||
return
|
||||
}
|
||||
|
||||
func ThirdRefund(check *thirdpay.PayCheck) (refund *thirdpay.Pay, errCode int) {
|
||||
refund = thirdpay.NewPayWithPayCheck(check)
|
||||
if refund.CheckRefundOrder() {
|
||||
refund.CreateOrder(common.ORDER_TYPE_REFUND)
|
||||
if refund.PayCode != errorcode.Success {
|
||||
return refund, refund.PayCode
|
||||
}
|
||||
}
|
||||
|
||||
refund.Refund()
|
||||
return refund, refund.PayCode
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue