订单配送,打印机

This commit is contained in:
邹宗楠
2022-06-01 15:36:08 +08:00
parent 1eae9e6ba4
commit b5a0ab5757
6 changed files with 100 additions and 30 deletions

View File

@@ -118,26 +118,40 @@ func onTTPayRefund(msg *wxpayapi.RefundResultMsg) (err error) {
return err
}
func refundOrderByTT(ctx *jxcontext.Context, orderPay *model.OrderPay, refundID string, refundFee int, refundDesc string) (orderPayRefund *model.OrderPayRefund, err error) {
result, err := api.WxpayAPI.PayRefund(&wxpayapi.PayRefundParam{
OutTradeNo: orderPay.VendorOrderID,
NotifyURL: globals.WxpayNotifyURL,
OutRefundNo: refundID,
TotalFee: orderPay.TotalFee,
RefundFee: refundFee,
RefundDesc: wxpayapi.CData(refundDesc),
// 申请退款
func RefundOrderByTT(ctx *jxcontext.Context, orderPay *model.OrderPay, refundID string, refundFee int, refundDesc string) (orderPayRefund *model.OrderPayRefund, err error) {
result, err := api.TiktokApi.RefundOrderTT(&tiktok.RefundOrderReq{
AppID: api.TiktokApi.GetAppID(),
OutOrderNo: orderPay.VendorOrderID,
OutRefundNo: refundID,
Reason: refundDesc,
RefundAmount: orderPay.TotalFee,
CpExtra: "msg",
NotifyURL: globals.TictokpayNotifyURL,
})
if err == nil {
orderPayRefund = &model.OrderPayRefund{
RefundID: refundID,
VendorRefundID: result.RefundID,
VendorRefundID: result,
VendorOrderID: orderPay.VendorOrderID,
VendorID: orderPay.VendorID,
Status: model.RefundStatusNo,
TransactionID: orderPay.TransactionID,
RefundFee: orderPay.TotalFee,
RefundFee: refundFee,
RefundCreatedAt: time.Now(),
}
dao.WrapAddIDCULDEntity(orderPayRefund, ctx.GetUserName())
db := dao.GetDB()
if result != "" {
orderPayRefund.Status = model.RefundStatusYes
} else {
orderPayRefund.Status = model.RefundStatusFailed
}
orderPayRefund.OriginalData = utils.Format4Output(result, true)
dao.CreateEntity(db, orderPayRefund)
orderPay.Status = model.PayStatusRefund
dao.UpdateEntity(db, orderPay)
}
return orderPayRefund, err
}