1
This commit is contained in:
@@ -158,7 +158,8 @@ func OrderStatusCallback(param *lakala.QueryOrderCallBackResp) error {
|
||||
var (
|
||||
db = dao.GetDB()
|
||||
)
|
||||
order, err := partner.CurOrderManager.LoadOrder(param.OrderCreateTime, model.VendorIDJX)
|
||||
|
||||
order, err := partner.CurOrderManager.LoadOrder(param.OutOrderNo, model.VendorIDJX)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -181,7 +182,34 @@ func OrderStatusCallback(param *lakala.QueryOrderCallBackResp) error {
|
||||
case "6":
|
||||
|
||||
}
|
||||
order.VendorOrderID2 = param.OrderTradeInfo.LogNo
|
||||
order.VendorStatus = param.OrderStatus
|
||||
_, err = dao.UpdateEntity(db, order, "Status", "VendorStatus", "OrderFinishedAt")
|
||||
_, err = dao.UpdateEntity(db, order, "Status", "VendorOrderID2", "VendorStatus", "OrderFinishedAt")
|
||||
|
||||
orderPay := &model.OrderPay{
|
||||
PayOrderID: param.PayOrderNo,
|
||||
}
|
||||
orderPay.DeletedAt = utils.DefaultTimeValue
|
||||
if err := dao.GetEntity(db, orderPay, "PayOrderID", "DeletedAt"); err == nil {
|
||||
if orderPay.Status != 0 {
|
||||
return err
|
||||
}
|
||||
loc, _ := time.LoadLocation("Local")
|
||||
t1, _ := time.ParseInLocation("20060102150405", param.OrderTradeInfo.TradeTime, loc)
|
||||
orderPay.PayFinishedAt = utils.Time2Pointer(t1)
|
||||
orderPay.OriginalData = utils.Format4Output(param, true)
|
||||
//TradeType string `json:"trade_type"` // M String 16 交易类型 PAY-消费 REFUND-退款 CANCEL-撤销
|
||||
//TradeStatus string `json:"trade_status"` // M String 2 支付状态 返回状态 S:成功 F:失败 C:被冲正 U:预记状态 X:发送失败 T: 发送超时 P: 处理中
|
||||
orderPay.TransactionID = param.OrderTradeInfo.LogNo
|
||||
switch param.OrderTradeInfo.TradeStatus {
|
||||
case "S":
|
||||
orderPay.Status = model.PayStatusYes
|
||||
default:
|
||||
orderPay.Status = model.PayStatusFailed
|
||||
}
|
||||
|
||||
dao.UpdateEntity(db, orderPay)
|
||||
}
|
||||
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -517,7 +517,7 @@ func Separate(ctx *jxcontext.Context, param *lakala.OrderSeparateReq) (string, s
|
||||
param.OutSeparateNo = lakala.GetOrderNumber(10)
|
||||
param.NotifyUrl = lakala.CallbackLaKaLaSeparateUrl
|
||||
|
||||
status, separateNo, logNo, err := api.LaKaLaApi.Separate(param)
|
||||
status, separateNo, err := api.LaKaLaApi.Separate(param)
|
||||
if err != nil {
|
||||
return "", "", err
|
||||
}
|
||||
@@ -530,9 +530,9 @@ func Separate(ctx *jxcontext.Context, param *lakala.OrderSeparateReq) (string, s
|
||||
FinishDate: "",
|
||||
TotalAmt: param.TotalAmt,
|
||||
Status: status,
|
||||
LogNo: logNo,
|
||||
DetailData: string(recv),
|
||||
Remark: "分账",
|
||||
//LogNo: logNo,
|
||||
DetailData: string(recv),
|
||||
Remark: "分账",
|
||||
}
|
||||
t, err := time.Parse("20060102", param.LogDate)
|
||||
if err != nil {
|
||||
@@ -700,7 +700,7 @@ func SubMerchantInfoQuery(merInnerNo, merCupNo string) ([]*lakala.SubMerchantInf
|
||||
//#region 订单相关
|
||||
|
||||
// CreateOrder 创建拉卡拉交易订单
|
||||
func CreateOrder(vendorOrderID, merchantNo string, vendorId int) (*lakala.CreateOrderResp, error) {
|
||||
func CreateOrder(ctx *jxcontext.Context, vendorOrderID, merchantNo string, vendorId int) (*lakala.CreateOrderResp, error) {
|
||||
order, err := partner.CurOrderManager.LoadOrder(vendorOrderID, vendorId)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@@ -719,6 +719,22 @@ func CreateOrder(vendorOrderID, merchantNo string, vendorId int) (*lakala.Create
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
orderPay := &model.OrderPay{
|
||||
PayOrderID: result.PayOrderNo,
|
||||
PayType: model.PayTypeLaKaLa,
|
||||
VendorPayType: lakala.PayWayRegister,
|
||||
TransactionID: "",
|
||||
VendorOrderID: order.VendorOrderID,
|
||||
VendorID: order.VendorID,
|
||||
Status: 0,
|
||||
PayCreatedAt: time.Now(),
|
||||
PrepayID: result.PayOrderNo,
|
||||
CodeURL: "",
|
||||
TotalFee: int(order.ActualPayPrice),
|
||||
}
|
||||
dao.WrapAddIDCULDEntity(orderPay, ctx.GetUserName())
|
||||
err = dao.CreateEntity(dao.GetDB(), orderPay)
|
||||
return result, nil
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user