修改申请退款

This commit is contained in:
邹宗楠
2022-06-07 15:16:30 +08:00
parent ab7d1edfee
commit 1d1866be68
3 changed files with 7 additions and 3 deletions

View File

@@ -21,6 +21,7 @@ const (
VendorIDPurchaseEnd = 11 VendorIDPurchaseEnd = 11
VendorIDJX = 9 // 这是一个假的京西VendorID VendorIDJX = 9 // 这是一个假的京西VendorID
VendorGoMei = 12 // 国美 VendorGoMei = 12 // 国美
VendorIDTT = 13 // 抖音平台小程序
VendorIDWXPay = 51 // 微信支付 VendorIDWXPay = 51 // 微信支付

View File

@@ -70,7 +70,7 @@ func onTTPayFinished(msg *tiktok.DetailCallBackMessage) (err error) {
db := dao.GetDB() db := dao.GetDB()
if err = dao.GetEntity(db, orderPay, "PayOrderID", "PayType", "DeletedAt"); err == nil { if err = dao.GetEntity(db, orderPay, "PayOrderID", "PayType", "DeletedAt"); err == nil {
loc, _ := time.LoadLocation("Local") loc, _ := time.LoadLocation("Local")
t1, _ := time.ParseInLocation("20060102150405", time.Unix(msg.PaidAt,0).Format("20060102150405"), loc) t1, _ := time.ParseInLocation("20060102150405", time.Unix(msg.PaidAt, 0).Format("20060102150405"), loc)
orderPay.PayFinishedAt = utils.Time2Pointer(t1) orderPay.PayFinishedAt = utils.Time2Pointer(t1)
orderPay.TransactionID = msg.ChannelNo orderPay.TransactionID = msg.ChannelNo
orderPay.OriginalData = utils.Format4Output(msg, true) orderPay.OriginalData = utils.Format4Output(msg, true)
@@ -79,7 +79,7 @@ func onTTPayFinished(msg *tiktok.DetailCallBackMessage) (err error) {
} else { } else {
orderPay.Status = model.PayStatusFailed orderPay.Status = model.PayStatusFailed
} }
dao.UpdateEntity(db, orderPay) dao.UpdateEntity(db, &orderPay)
if msg.Status == tiktok.ResponseCodeSuccess { if msg.Status == tiktok.ResponseCodeSuccess {
err = OnPayFinished(orderPay) err = OnPayFinished(orderPay)
} }
@@ -89,7 +89,6 @@ func onTTPayFinished(msg *tiktok.DetailCallBackMessage) (err error) {
return err return err
} }
func onTTPayRefund(msg *tiktok.DetailCallBackMessage2Refund) (err error) { func onTTPayRefund(msg *tiktok.DetailCallBackMessage2Refund) (err error) {
globals.SugarLogger.Debugf("退款回调==================2") globals.SugarLogger.Debugf("退款回调==================2")
orderPayRefund := &model.OrderPayRefund{ orderPayRefund := &model.OrderPayRefund{
@@ -133,6 +132,8 @@ func RefundOrderByTT(ctx *jxcontext.Context, orderPay *model.OrderPay, refundID
CpExtra: "msg", CpExtra: "msg",
NotifyURL: globals.TictokpayNotifyURL, NotifyURL: globals.TictokpayNotifyURL,
}) })
globals.SugarLogger.Debug("申请退款============",err)
globals.SugarLogger.Debug("申请退款============",result)
if err == nil { if err == nil {
orderPayRefund = &model.OrderPayRefund{ orderPayRefund = &model.OrderPayRefund{
RefundID: refundID, RefundID: refundID,

View File

@@ -64,6 +64,8 @@ func (a *APIManager) GetAPI(vendorID int, appOrgCode string) (pfAPI interface{})
pfAPI = api.JdShopAPI pfAPI = api.JdShopAPI
case model.VendorGoMei: case model.VendorGoMei:
pfAPI = api.GuoMeiApi pfAPI = api.GuoMeiApi
case model.VendorIDTT:
pfAPI = api.TiktokApi
} }
return pfAPI return pfAPI
} }