退款fix
This commit is contained in:
parent
39162a1750
commit
fe0fe5123f
|
@ -87,6 +87,9 @@ const (
|
|||
PreRefundFail = 1702
|
||||
|
||||
ThirdRefundFail = 1710
|
||||
|
||||
// 退款
|
||||
RefundOutTradeNoSame = 1801
|
||||
)
|
||||
|
||||
var MsgEN = map[int]string{
|
||||
|
@ -160,6 +163,7 @@ var MsgZH = map[int]string{
|
|||
PreRefundFail: "创建退款单失败",
|
||||
OrderNotSupportRefundPart: "订单暂不支持部分退款",
|
||||
OrderRefundAmountError: "退款金额错误",
|
||||
RefundOutTradeNoSame: "支付商户单号和退款商户单号不能相同",
|
||||
|
||||
ThirdRefundFail: "第三方退款失败",
|
||||
}
|
||||
|
|
|
@ -55,7 +55,7 @@ func NewPayWithPayCheck(paycheck *PayCheck) *Pay {
|
|||
|
||||
func (w *Pay) CheckRefundOrder() bool {
|
||||
cond := builder.NewCond()
|
||||
cond = cond.And(builder.Eq{"app_id": w.PayParam.App_id}, builder.Eq{"out_trade_no": w.PayParam.OutTradeNo})
|
||||
cond = cond.And(builder.Eq{"app_id": w.PayParam.App_id}, builder.Eq{"order_type": common.ORDER_TYPE_REFUND}, builder.Eq{"out_trade_no": w.PayParam.OutTradeNo})
|
||||
order, code := services.OrderFindOne(&ordersmodel.Orders{}, cond)
|
||||
if code != errorcode.Success {
|
||||
return true
|
||||
|
|
|
@ -80,6 +80,7 @@ func (w *PayCheck) CheckOrderPay() {
|
|||
}
|
||||
|
||||
func (w *PayCheck) CheckOrderRefund() (order *ordersmodel.Orders) {
|
||||
// 查询原来的支付单
|
||||
w.GetOldOrder(&types.OrderFindOne{
|
||||
OutTradeNo: w.Reqs.RefundOutTradeNo,
|
||||
OrderId: w.Reqs.RefundOrderId,
|
||||
|
|
|
@ -48,6 +48,10 @@ func ThirdPayInfoCheck(ctx context.Context, payReq *front.PayReqs, appCheck *ser
|
|||
|
||||
func ThirdPayRefundCheck(ctx context.Context, refundReq *front.RefundReqs, appCheck *services.AppCheck, ip string) (check *thirdpay.PayCheck, errorCode int) {
|
||||
var req types.Reqs
|
||||
// 外部商户单号,支付商户单号和退款商户单号不能相同
|
||||
if refundReq.OutTradeNo == refundReq.RefundOutTradeNo {
|
||||
return check, errorcode.RefundOutTradeNoSame
|
||||
}
|
||||
copier.Copy(&req, refundReq)
|
||||
check = thirdpay.NewPayCheck(&ctx, &req, appCheck, ip)
|
||||
// 校验表单
|
||||
|
|
Loading…
Reference in New Issue