通联宝支付测试
This commit is contained in:
@@ -591,7 +591,12 @@ func CancelOrder(ctx *jxcontext.Context, order *model.GoodsOrder, reason string)
|
|||||||
if orderPay.Status == model.PayStatusYes {
|
if orderPay.Status == model.PayStatusYes {
|
||||||
// refundID := utils.Int64ToStr(GenRefundID(order))
|
// refundID := utils.Int64ToStr(GenRefundID(order))
|
||||||
refundID := order.VendorOrderID
|
refundID := order.VendorOrderID
|
||||||
orderPayRefund, err2 := refundOrderByWX(ctx, orderPay, refundID, orderPay.TotalFee, reason)
|
var orderPayRefund *model.OrderPayRefund
|
||||||
|
if orderPay.PayType == model.PayTypeWX {
|
||||||
|
orderPayRefund, err = refundOrderByWX(ctx, orderPay, refundID, orderPay.TotalFee, reason)
|
||||||
|
} else if orderPay.PayType == model.PayTypeTL {
|
||||||
|
orderPayRefund, err = refundOrderByTL(ctx, orderPay, refundID, orderPay.TotalFee, reason)
|
||||||
|
}
|
||||||
if err2 == nil {
|
if err2 == nil {
|
||||||
dao.WrapAddIDCULDEntity(orderPayRefund, ctx.GetUserName())
|
dao.WrapAddIDCULDEntity(orderPayRefund, ctx.GetUserName())
|
||||||
errList.AddErr(dao.CreateEntity(dao.GetDB(), orderPayRefund))
|
errList.AddErr(dao.CreateEntity(dao.GetDB(), orderPayRefund))
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ import (
|
|||||||
"git.rosy.net.cn/baseapi/utils"
|
"git.rosy.net.cn/baseapi/utils"
|
||||||
|
|
||||||
"git.rosy.net.cn/jx-callback/business/auth2/authprovider/weixin"
|
"git.rosy.net.cn/jx-callback/business/auth2/authprovider/weixin"
|
||||||
|
"git.rosy.net.cn/jx-callback/business/jxutils"
|
||||||
"git.rosy.net.cn/jx-callback/business/jxutils/jxcontext"
|
"git.rosy.net.cn/jx-callback/business/jxutils/jxcontext"
|
||||||
"git.rosy.net.cn/jx-callback/business/model"
|
"git.rosy.net.cn/jx-callback/business/model"
|
||||||
"git.rosy.net.cn/jx-callback/business/model/dao"
|
"git.rosy.net.cn/jx-callback/business/model/dao"
|
||||||
@@ -121,33 +122,33 @@ func onTLpayFinished(call *tonglianpayapi.CallBackResult) (err error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func onTLpayRefund(call *tonglianpayapi.CallBackResult) (err error) {
|
func onTLpayRefund(call *tonglianpayapi.CallBackResult) (err error) {
|
||||||
// orderPayRefund := &model.OrderPayRefund{
|
orderPayRefund := &model.OrderPayRefund{
|
||||||
// RefundID: call.CusorderID,
|
RefundID: call.CusorderID,
|
||||||
// }
|
}
|
||||||
// db := dao.GetDB()
|
db := dao.GetDB()
|
||||||
// if err = dao.GetEntity(db, orderPayRefund, "RefundID"); err == nil {
|
if err = dao.GetEntity(db, orderPayRefund, "RefundID"); err == nil {
|
||||||
// if msg.ResultCode == wxpayapi.ResponseCodeSuccess {
|
if call.TrxStatus == tonglianpayapi.TrxStatusSuccess {
|
||||||
// orderPayRefund.Status = model.RefundStatusYes
|
orderPayRefund.Status = model.RefundStatusYes
|
||||||
// } else {
|
} else {
|
||||||
// orderPayRefund.Status = model.RefundStatusFailed
|
orderPayRefund.Status = model.RefundStatusFailed
|
||||||
// }
|
}
|
||||||
// orderPayRefund.OriginalData = utils.Format4Output(msg, true)
|
orderPayRefund.OriginalData = utils.Format4Output(call, true)
|
||||||
// dao.UpdateEntity(db, orderPayRefund)
|
dao.UpdateEntity(db, orderPayRefund)
|
||||||
// } else if dao.IsNoRowsError(err) {
|
} else if dao.IsNoRowsError(err) {
|
||||||
// globals.SugarLogger.Warnf("收到异常的退款事件, msg:%s", utils.Format4Output(msg, true))
|
globals.SugarLogger.Warnf("收到异常的退款事件, call:%s", utils.Format4Output(call, true))
|
||||||
// }
|
}
|
||||||
|
|
||||||
// orderPay := &model.OrderPay{
|
orderPay := &model.OrderPay{
|
||||||
// VendorOrderID: orderPayRefund.VendorOrderID,
|
VendorOrderID: orderPayRefund.VendorOrderID,
|
||||||
// VendorID: jxutils.GetPossibleVendorIDFromVendorOrderID(orderPayRefund.VendorOrderID),
|
VendorID: jxutils.GetPossibleVendorIDFromVendorOrderID(orderPayRefund.VendorOrderID),
|
||||||
// PayType: model.PayTypeWX,
|
PayType: model.PayTypeWX,
|
||||||
// Status: model.PayStatusYes,
|
Status: model.PayStatusYes,
|
||||||
// }
|
}
|
||||||
// orderPay.DeletedAt = utils.DefaultTimeValue
|
orderPay.DeletedAt = utils.DefaultTimeValue
|
||||||
// if err = dao.GetEntity(db, orderPay, "VendorOrderID", "VendorID", "PayType", "Status", "DeletedAt"); err == nil {
|
if err = dao.GetEntity(db, orderPay, "VendorOrderID", "VendorID", "PayType", "Status", "DeletedAt"); err == nil {
|
||||||
// orderPay.Status = model.PayStatusRefund
|
orderPay.Status = model.PayStatusRefund
|
||||||
// dao.UpdateEntity(db, orderPay)
|
dao.UpdateEntity(db, orderPay)
|
||||||
// }
|
}
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user