修改拉卡拉卡分账
This commit is contained in:
@@ -211,5 +211,11 @@ func OrderStatusCallback(param *lakala.QueryOrderCallBackResp) error {
|
|||||||
dao.UpdateEntity(db, orderPay)
|
dao.UpdateEntity(db, orderPay)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
separate, _ := dao.GetSeparateAmtByOrderID(order.VendorOrderID, lakala.SeparateType_SEPATRATE, "")
|
||||||
|
if separate != nil {
|
||||||
|
separate.LogNo = param.OrderTradeInfo.LogNo
|
||||||
|
separate.Remark += "->收银台订单未分账"
|
||||||
|
dao.UpdateEntity(db, separate, "LogNo", "Remark")
|
||||||
|
}
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -490,61 +490,51 @@ func SeparateUnBind(param *lakala.SeparateUnBindReq) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// SeparateQueryAmt 可分账金额查询
|
// SeparateQueryAmt 可分账金额查询
|
||||||
func SeparateQueryAmt(merchantNo, logDate, logNo string) (*lakala.SeparateQueryAmtResp, error) {
|
func SeparateQueryAmt(merchantNo, logDate, logNo, vendorOrderId string) (*lakala.SeparateQueryAmtResp, error) {
|
||||||
result, err := api.LaKaLaApi.SeparateQueryAmt(merchantNo, logNo, logDate)
|
result, err := api.LaKaLaApi.SeparateQueryAmt(merchantNo, logNo, logDate)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
db := dao.GetDB()
|
separate, _ := dao.GetSeparateAmtByOrderID(vendorOrderId, "", logNo)
|
||||||
merchant, err := dao.GetStoreInfoByMerchantID(db, merchantNo, 0, "", "")
|
if separate != nil {
|
||||||
if err != nil {
|
separate.TotalAmt = result.TotalSeparateAmt
|
||||||
return nil, err
|
separate.ActualSeparateAmt = result.CanSeparateAmt
|
||||||
}
|
dao.UpdateEntity(dao.GetDB(), separate, "TotalAmt", "ActualSeparateAmt")
|
||||||
merchant.TotalAmt = result.TotalSeparateAmt
|
|
||||||
merchant.CanAmt = result.CanSeparateAmt
|
|
||||||
if _, err = dao.UpdateEntity(db, merchant, "TotalAmt", "CanAmt"); err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return result, err
|
return result, err
|
||||||
}
|
}
|
||||||
|
|
||||||
// Separate 分账
|
// Separate 分账
|
||||||
func Separate(ctx *jxcontext.Context, param *lakala.OrderSeparateReq) (string, string, error) {
|
func Separate(ctx *jxcontext.Context, param *lakala.OrderSeparateReq, vendorOrderId string) (*lakala.OrderSeparateResp, error) {
|
||||||
param.LogNo = lakala.GetOrderNumber(8)
|
separateObj, err := dao.GetSeparateAmtByOrderID(vendorOrderId, "", param.LogNo)
|
||||||
param.LogDate = utils.Time2TimeStrByFormat(time.Now(), "20060102")
|
|
||||||
param.OutSeparateNo = lakala.GetOrderNumber(10)
|
|
||||||
param.NotifyUrl = lakala.CallbackLaKaLaSeparateUrl
|
|
||||||
|
|
||||||
status, separateNo, err := api.LaKaLaApi.Separate(param)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return "", "", err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
param.NotifyUrl = lakala.CallbackLaKaLaSeparateUrl
|
||||||
|
resp, err := api.LaKaLaApi.Separate(param)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
recv, _ := json.Marshal(param.RecvDatas)
|
recv, _ := json.Marshal(param.RecvDatas)
|
||||||
separateData := &model.LakalaSeparateAmt{
|
separateObj.OutSeparateNo = resp.RespData.OutSeparateNo
|
||||||
MerchantNo: param.MerchantNo,
|
separateObj.SeparateNo = resp.RespData.SeparateNo
|
||||||
OutSeparateNo: param.OutSeparateNo, // 商户分账指令流水号
|
separateObj.CalType = param.CalType
|
||||||
SeparateNo: separateNo,
|
separateObj.TotalAmt = resp.RespData.TotalAmt
|
||||||
CalType: param.CalType,
|
separateObj.Status = resp.RespData.Status
|
||||||
FinishDate: "",
|
separateObj.Remark += `->分账`
|
||||||
TotalAmt: param.TotalAmt,
|
separateObj.DetailData = string(recv)
|
||||||
Status: status,
|
|
||||||
//LogNo: logNo,
|
|
||||||
DetailData: string(recv),
|
|
||||||
Remark: "分账",
|
|
||||||
}
|
|
||||||
t, err := time.Parse("20060102", param.LogDate)
|
t, err := time.Parse("20060102", param.LogDate)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t = time.Now()
|
t = time.Now()
|
||||||
}
|
}
|
||||||
separateData.LogDate = t
|
separateObj.LogDate = t
|
||||||
dao.WrapAddIDCULEntity(separateData, ctx.GetUserName())
|
dao.UpdateEntity(dao.GetDB(), &separateObj)
|
||||||
|
|
||||||
if err = dao.CreateEntity(dao.GetDB(), separateData); err != nil {
|
return resp, err
|
||||||
return "", "", err
|
|
||||||
}
|
|
||||||
return status, separateNo, nil
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// SeparateResultQuery 分账结果查询
|
// SeparateResultQuery 分账结果查询
|
||||||
@@ -594,11 +584,12 @@ func SeparateCancel(merchantNo, separateNo string) (*lakala.SeparateCancelResp,
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
separateAmt.CmdType = lakala.SeparateCancel
|
||||||
separateAmt.Status = result.RespData.Status
|
separateAmt.Status = result.RespData.Status
|
||||||
separateAmt.SeparateNo = result.RespData.SeparateNo
|
//separateAmt.SeparateNo = result.RespData.SeparateNo
|
||||||
separateAmt.Remark += ",分账撤销"
|
separateAmt.Remark += "->分账撤销"
|
||||||
|
|
||||||
if _, err = dao.UpdateEntity(db, separateAmt, "SeparateNo2", "Status2", "Remark"); err != nil {
|
if _, err = dao.UpdateEntity(db, separateAmt, "CmdType", "Status", "Remark"); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -643,9 +634,10 @@ func SeparateFallBack(merchantNo, separateNo, reason string) (*lakala.SeparateFa
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
separateAmt.CmdType = lakala.SeparateFallBack
|
||||||
separateAmt.Status = result.RespData.Status
|
separateAmt.Status = result.RespData.Status
|
||||||
separateAmt.SeparateNo = result.RespData.SeparateNo
|
separateAmt.Remark += "->分账退回"
|
||||||
separateAmt.Remark += ",分账退回"
|
dao.UpdateEntity(db, separateAmt, "CmdType", "Status", "Remark")
|
||||||
|
|
||||||
return result, nil
|
return result, nil
|
||||||
}
|
}
|
||||||
@@ -723,7 +715,7 @@ func CreateOrder(ctx *jxcontext.Context, vendorOrderID, merchantNo string, vendo
|
|||||||
orderPay := &model.OrderPay{
|
orderPay := &model.OrderPay{
|
||||||
PayOrderID: result.PayOrderNo,
|
PayOrderID: result.PayOrderNo,
|
||||||
PayType: model.PayTypeLaKaLa,
|
PayType: model.PayTypeLaKaLa,
|
||||||
VendorPayType: lakala.PayWayRegister,
|
VendorPayType: lakala.PayWayAPP,
|
||||||
TransactionID: "",
|
TransactionID: "",
|
||||||
VendorOrderID: order.VendorOrderID,
|
VendorOrderID: order.VendorOrderID,
|
||||||
VendorID: order.VendorID,
|
VendorID: order.VendorID,
|
||||||
@@ -735,6 +727,29 @@ func CreateOrder(ctx *jxcontext.Context, vendorOrderID, merchantNo string, vendo
|
|||||||
}
|
}
|
||||||
dao.WrapAddIDCULDEntity(orderPay, ctx.GetUserName())
|
dao.WrapAddIDCULDEntity(orderPay, ctx.GetUserName())
|
||||||
err = dao.CreateEntity(dao.GetDB(), orderPay)
|
err = dao.CreateEntity(dao.GetDB(), orderPay)
|
||||||
|
|
||||||
|
separate := &model.LakalaSeparateAmt{
|
||||||
|
MerchantNo: merchantNo,
|
||||||
|
VendorOrderID: order.VendorOrderID,
|
||||||
|
StoreId: order.JxStoreID,
|
||||||
|
CmdType: lakala.SeparateType_SEPATRATE,
|
||||||
|
Status: "1",
|
||||||
|
LogNo: "",
|
||||||
|
LogDate: time.Now(),
|
||||||
|
SeparateNo: "",
|
||||||
|
OutSeparateNo: "",
|
||||||
|
CalType: "",
|
||||||
|
FinishDate: "",
|
||||||
|
TotalAmt: "",
|
||||||
|
ActualSeparateAmt: "",
|
||||||
|
TotalFeeAmt: "",
|
||||||
|
FinalStatus: "",
|
||||||
|
DetailData: "",
|
||||||
|
Remark: "",
|
||||||
|
}
|
||||||
|
dao.WrapAddIDCULEntity(separate, ctx.GetUserName())
|
||||||
|
err = dao.CreateEntity(dao.GetDB(), separate)
|
||||||
|
|
||||||
return result, nil
|
return result, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -945,7 +960,7 @@ func GetRecipientList(orgCode, receiverNo, receiverName string, offset, pageSize
|
|||||||
}
|
}
|
||||||
|
|
||||||
// GetSeparateAmt 分账流水查询
|
// GetSeparateAmt 分账流水查询
|
||||||
func GetSeparateAmt(merchantNo, cmdType, status, separateNo, separateTimeStart, separateTimeEnd string, offset, pageSize int) (pagedInfo *model.PagedInfo, err error) {
|
func GetSeparateAmt(merchantNo, cmdType, status, separateNo, separateTimeStart, separateTimeEnd, vendorOrderID string, storeId int, offset, pageSize int) (pagedInfo *model.PagedInfo, err error) {
|
||||||
var (
|
var (
|
||||||
start time.Time
|
start time.Time
|
||||||
end time.Time
|
end time.Time
|
||||||
@@ -956,7 +971,7 @@ func GetSeparateAmt(merchantNo, cmdType, status, separateNo, separateTimeStart,
|
|||||||
if separateTimeEnd != "" {
|
if separateTimeEnd != "" {
|
||||||
end = utils.Str2Time(separateTimeEnd)
|
end = utils.Str2Time(separateTimeEnd)
|
||||||
}
|
}
|
||||||
return dao.GetSeparateAmt(merchantNo, cmdType, status, separateNo, start, end, offset, pageSize)
|
return dao.GetSeparateAmt(merchantNo, cmdType, status, separateNo, vendorOrderID, storeId, start, end, offset, pageSize)
|
||||||
}
|
}
|
||||||
|
|
||||||
// WithdrawalList 提现流水查询
|
// WithdrawalList 提现流水查询
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ func GetStoreInfoByMerchantID(db *DaoDB, merchantNo string, storeId int, applyId
|
|||||||
sql := ` SELECT * FROM lakala_incoming WHERE 1=1 `
|
sql := ` SELECT * FROM lakala_incoming WHERE 1=1 `
|
||||||
|
|
||||||
if merchantNo != "" {
|
if merchantNo != "" {
|
||||||
sql += ` AND merchant_no = ?`
|
sql += ` AND merchant_no = ? OR merchant_no2 = ? `
|
||||||
param = append(param, merchantNo)
|
param = append(param, merchantNo)
|
||||||
}
|
}
|
||||||
if storeId != model.NO {
|
if storeId != model.NO {
|
||||||
@@ -84,17 +84,15 @@ func GetSeparateRecords(db *DaoDB, merchantNo, separateNo, cmsType string) (*mod
|
|||||||
sql += ` AND merchant_no = ?`
|
sql += ` AND merchant_no = ?`
|
||||||
param = append(param, merchantNo)
|
param = append(param, merchantNo)
|
||||||
}
|
}
|
||||||
switch cmsType {
|
if separateNo != "" {
|
||||||
case model.CmdTypeSeparate:
|
sql += ` AND separate_no = ?`
|
||||||
sql += ` AND separate_no1 = ?`
|
|
||||||
case model.CmdTypeCancel:
|
|
||||||
sql += ` AND separate_no2 = ?`
|
|
||||||
case model.CmdTypeFallBack:
|
|
||||||
sql += ` AND separate_no3 = ?`
|
|
||||||
default:
|
|
||||||
sql += ` AND separate_no1 = ?`
|
|
||||||
}
|
|
||||||
param = append(param, separateNo)
|
param = append(param, separateNo)
|
||||||
|
}
|
||||||
|
if cmsType != "" {
|
||||||
|
sql += ` AND cmd_type = ?`
|
||||||
|
param = append(param, cmsType)
|
||||||
|
}
|
||||||
|
param = append(param)
|
||||||
|
|
||||||
if err := GetRow(db, records, sql, param...); err != nil {
|
if err := GetRow(db, records, sql, param...); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
@@ -206,8 +204,29 @@ func GetRecipientList(orgCode, receiverNo, receiverName string, offset, pageSize
|
|||||||
return pagedInfo, nil
|
return pagedInfo, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// GetSeparateAmtByOrderID 根据订单ID查询分账记录
|
||||||
|
func GetSeparateAmtByOrderID(vendorOrderID string, cmdType string, logNo string) (*model.LakalaSeparateAmt, error) {
|
||||||
|
|
||||||
|
var recipient *model.LakalaSeparateAmt
|
||||||
|
sql := ` SELECT * FROM Lakala_separate_amt WHERE vendor_order_id = ?`
|
||||||
|
param := []interface{}{vendorOrderID}
|
||||||
|
if cmdType != "" {
|
||||||
|
sql += ` AND cmd_type = ? `
|
||||||
|
param = append(param, cmdType)
|
||||||
|
}
|
||||||
|
if logNo != "" {
|
||||||
|
sql += ` AND log_no = ? `
|
||||||
|
param = append(param, logNo)
|
||||||
|
}
|
||||||
|
if err := GetRow(GetDB(), &recipient, sql, param...); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
return recipient, nil
|
||||||
|
}
|
||||||
|
|
||||||
// GetSeparateAmt 交易流水查询
|
// GetSeparateAmt 交易流水查询
|
||||||
func GetSeparateAmt(merchantNo, cmdType, status, separateNo string, separateTimeStart, separateTimeEnd time.Time, offset, pageSize int) (pagedInfo *model.PagedInfo, err error) {
|
func GetSeparateAmt(merchantNo, cmdType, status, separateNo, vendorOrderID string, storeId int, separateTimeStart, separateTimeEnd time.Time, offset, pageSize int) (pagedInfo *model.PagedInfo, err error) {
|
||||||
db := GetDB()
|
db := GetDB()
|
||||||
txDB, _ := Begin(db)
|
txDB, _ := Begin(db)
|
||||||
defer func() {
|
defer func() {
|
||||||
@@ -224,6 +243,14 @@ func GetSeparateAmt(merchantNo, cmdType, status, separateNo string, separateTime
|
|||||||
sql += ` AND r.merchant_no = ? `
|
sql += ` AND r.merchant_no = ? `
|
||||||
param = append(param, merchantNo)
|
param = append(param, merchantNo)
|
||||||
}
|
}
|
||||||
|
if vendorOrderID != "" {
|
||||||
|
sql += ` AND r.vendor_order_id = ? `
|
||||||
|
param = append(param, vendorOrderID)
|
||||||
|
}
|
||||||
|
if storeId != 0 {
|
||||||
|
sql += ` AND r.store_id = ? `
|
||||||
|
param = append(param, storeId)
|
||||||
|
}
|
||||||
if cmdType != "" {
|
if cmdType != "" {
|
||||||
sql += ` AND r.cmd_type = ?`
|
sql += ` AND r.cmd_type = ?`
|
||||||
param = append(param, cmdType)
|
param = append(param, cmdType)
|
||||||
|
|||||||
@@ -124,16 +124,14 @@ func (o *LakalaRecipient) TableIndex() [][]string {
|
|||||||
type LakalaSeparateAmt struct {
|
type LakalaSeparateAmt struct {
|
||||||
ModelIDCUL
|
ModelIDCUL
|
||||||
MerchantNo string `orm:"column(merchant_no);size(20)" json:"merchantNo"` // 分账发起商户
|
MerchantNo string `orm:"column(merchant_no);size(20)" json:"merchantNo"` // 分账发起商户
|
||||||
|
VendorOrderID string `orm:"column(vendor_order_id);size(32)" json:"vendorOrderID"` // 京西订单ID
|
||||||
|
StoreId int `orm:"column(store_id);size(16)" json:"storeId"` // 门店ID
|
||||||
CmdType string `orm:"column(cmd_type);size(32)" json:"cmdType"` // SEPARATE:分账 CANCEL:分账撤销FALLBACK:分账回退
|
CmdType string `orm:"column(cmd_type);size(32)" json:"cmdType"` // SEPARATE:分账 CANCEL:分账撤销FALLBACK:分账回退
|
||||||
SeparateNo string `orm:"column(separate_no);size(32)" json:"separateNo"` // 分账系统生成唯一流水
|
Status string `orm:"column(status);size(32)" json:"status"` // 分账状态 1-未分账
|
||||||
Status string `orm:"column(status);size(32)" json:"status1"` // 分账状态
|
LogNo string `orm:"column(log_no);size(32)" json:"logNo"` // 交易流水号(订单)
|
||||||
//LogNo string `orm:"column(log_no);size(32)" json:"logNo"` // 交易流水号
|
|
||||||
//SeparateNo2 string `orm:"column(separate_no2);size(32)" json:"separateNo2"` // 分账撤销系统生成唯一流水
|
|
||||||
//Status2 string `orm:"column(status2);size(32)" json:"status2"` // 分账撤销状态
|
|
||||||
//SeparateNo3 string `orm:"column(separate_no3);size(32)" json:"separateNo3"` // 分账回退系统生成唯一流水
|
|
||||||
//Status3 string `orm:"column(status3);size(32)" json:"status3"` // 分账回退状态
|
|
||||||
OutSeparateNo string `orm:"column(out_separate_no);size(32)" json:"outSeparateNo"` // 商户分账指令流水号
|
|
||||||
LogDate time.Time `orm:"column(log_date);type(datetime)" json:"logDate"` // 交易日期
|
LogDate time.Time `orm:"column(log_date);type(datetime)" json:"logDate"` // 交易日期
|
||||||
|
OutSeparateNo string `orm:"column(out_separate_no);size(32)" json:"outSeparateNo"` // 商户分账指令流水号
|
||||||
|
SeparateNo string `orm:"column(separate_no);size(32)" json:"separateNo"` // 分账系统生成唯一流水
|
||||||
CalType string `orm:"column(cal_type);size(2)" json:"calType"` // 分账计算类型
|
CalType string `orm:"column(cal_type);size(2)" json:"calType"` // 分账计算类型
|
||||||
FinishDate string `orm:"column(finish_date);size(20)" json:"finishDate"` // 完成日期 yyyyMMdd
|
FinishDate string `orm:"column(finish_date);size(20)" json:"finishDate"` // 完成日期 yyyyMMdd
|
||||||
TotalAmt string `orm:"column(total_amt);size(15)" json:"totalAmt"` // 发生总金额
|
TotalAmt string `orm:"column(total_amt);size(15)" json:"totalAmt"` // 发生总金额
|
||||||
|
|||||||
@@ -216,19 +216,19 @@ func QueryBarCodeRefundStatus(afsOrderID string) (resp []*lakala.RefundOrderQuer
|
|||||||
}
|
}
|
||||||
|
|
||||||
// BarCodeScannerPayByLaKaLa 拉卡拉扫码枪扫码
|
// BarCodeScannerPayByLaKaLa 拉卡拉扫码枪扫码
|
||||||
func BarCodeScannerPayByLaKaLa(ctx *jxcontext.Context, vendorOrderId, userPaymentLabel, ip string) (string, error) {
|
func BarCodeScannerPayByLaKaLa(ctx *jxcontext.Context, vendorOrderId, userPaymentLabel, ip string) (*lakala.PayMicroPayResp, error) {
|
||||||
db := dao.GetDB()
|
db := dao.GetDB()
|
||||||
goodsOrder, err := dao.GetSimpleOrder(db, vendorOrderId)
|
goodsOrder, err := dao.GetSimpleOrder(db, vendorOrderId)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return "", err
|
return nil, err
|
||||||
}
|
}
|
||||||
if goodsOrder.VendorID != model.VendorIDJX {
|
if goodsOrder.VendorID != model.VendorIDJX {
|
||||||
return "", fmt.Errorf("此订单不是京西订单,无法使用该功能")
|
return nil, fmt.Errorf("此订单不是京西订单,无法使用该功能")
|
||||||
}
|
}
|
||||||
|
|
||||||
merchantObj, err := dao.GetStoreInfoByMerchantID(db, "", goodsOrder.JxStoreID, "", "")
|
merchantObj, err := dao.GetStoreInfoByMerchantID(db, "", goodsOrder.JxStoreID, "", "")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return "", err
|
return nil, err
|
||||||
}
|
}
|
||||||
parma := &lakala.PayMicroPayReq{
|
parma := &lakala.PayMicroPayReq{
|
||||||
MerchantNo: merchantObj.MerchantNo,
|
MerchantNo: merchantObj.MerchantNo,
|
||||||
@@ -243,33 +243,55 @@ func BarCodeScannerPayByLaKaLa(ctx *jxcontext.Context, vendorOrderId, userPaymen
|
|||||||
SettleType: "1",
|
SettleType: "1",
|
||||||
Subject: fmt.Sprintf("感谢您在本店%s消费,欢迎下次再来", goodsOrder.StoreName),
|
Subject: fmt.Sprintf("感谢您在本店%s消费,欢迎下次再来", goodsOrder.StoreName),
|
||||||
}
|
}
|
||||||
code, msg, tradeNo, logNo, err := api.LaKaLaApi.ScannerPayMicroPay(parma)
|
resp, err := api.LaKaLaApi.ScannerPayMicroPay(parma)
|
||||||
if code == lakala.PaySuccess {
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
goodsOrder.Status = model.OrderStatusFinished
|
goodsOrder.Status = model.OrderStatusFinished
|
||||||
goodsOrder.VendorStatus = code
|
goodsOrder.VendorStatus = lakala.PayStatusSUCCESS
|
||||||
goodsOrder.VendorOrderID2 = logNo
|
goodsOrder.VendorOrderID2 = resp.LogNo
|
||||||
goodsOrder.OrderFinishedAt = time.Now()
|
goodsOrder.OrderFinishedAt = time.Now()
|
||||||
dao.UpdateEntity(db, goodsOrder, "Status", "VendorStatus", "OrderFinishedAt", "VendorOrderID2")
|
dao.UpdateEntity(db, goodsOrder, "Status", "VendorStatus", "OrderFinishedAt", "VendorOrderID2")
|
||||||
return "支付成功", nil
|
|
||||||
}
|
|
||||||
|
|
||||||
payInfo := &model.OrderPay{
|
payInfo := &model.OrderPay{
|
||||||
PayOrderID: tradeNo,
|
PayOrderID: resp.TradeNo,
|
||||||
PayType: model.PayTypeLaKaLa,
|
PayType: model.PayTypeLaKaLa,
|
||||||
VendorPayType: lakala.PayWayAPP,
|
VendorPayType: lakala.PayWayRegister,
|
||||||
TransactionID: logNo,
|
TransactionID: resp.LogNo,
|
||||||
VendorOrderID: goodsOrder.VendorOrderID,
|
VendorOrderID: goodsOrder.VendorOrderID,
|
||||||
VendorID: goodsOrder.VendorID,
|
VendorID: goodsOrder.VendorID,
|
||||||
Status: 0,
|
Status: 0,
|
||||||
PayCreatedAt: time.Now(),
|
PayCreatedAt: time.Now(),
|
||||||
PrepayID: tradeNo,
|
PrepayID: resp.TradeNo,
|
||||||
CodeURL: "",
|
CodeURL: "",
|
||||||
TotalFee: int(goodsOrder.ActualPayPrice),
|
TotalFee: int(goodsOrder.ActualPayPrice),
|
||||||
}
|
}
|
||||||
dao.WrapAddIDCULDEntity(payInfo, ctx.GetUserName())
|
dao.WrapAddIDCULDEntity(payInfo, ctx.GetUserName())
|
||||||
dao.CreateEntity(db, payInfo)
|
dao.CreateEntity(db, payInfo)
|
||||||
|
|
||||||
return msg, err
|
separate := &model.LakalaSeparateAmt{
|
||||||
|
MerchantNo: merchantObj.MerchantNo2,
|
||||||
|
VendorOrderID: goodsOrder.VendorOrderID,
|
||||||
|
StoreId: goodsOrder.JxStoreID,
|
||||||
|
CmdType: lakala.SeparateType_SEPATRATE,
|
||||||
|
Status: "1",
|
||||||
|
LogNo: resp.LogNo,
|
||||||
|
LogDate: time.Now(),
|
||||||
|
OutSeparateNo: "",
|
||||||
|
SeparateNo: "",
|
||||||
|
CalType: "",
|
||||||
|
FinishDate: "",
|
||||||
|
TotalAmt: "",
|
||||||
|
ActualSeparateAmt: "",
|
||||||
|
TotalFeeAmt: "",
|
||||||
|
FinalStatus: "",
|
||||||
|
DetailData: "",
|
||||||
|
Remark: "聚合被扫订单",
|
||||||
|
}
|
||||||
|
dao.WrapAddIDCULEntity(separate, ctx.GetUserName())
|
||||||
|
dao.CreateEntity(db, separate)
|
||||||
|
|
||||||
|
return resp, err
|
||||||
}
|
}
|
||||||
|
|
||||||
// LaKaLaBarCodeScannerStatus 刷新当前订单的支付状态
|
// LaKaLaBarCodeScannerStatus 刷新当前订单的支付状态
|
||||||
|
|||||||
@@ -22,7 +22,8 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func pay4OrderByLaKaLa(ctx *jxcontext.Context, order *model.GoodsOrder, payType int, vendorPayType, subAppID, code, source string) (orderPay *model.OrderPay, err error) {
|
func pay4OrderByLaKaLa(ctx *jxcontext.Context, order *model.GoodsOrder, payType int, vendorPayType, subAppID, code, source string) (orderPay *model.OrderPay, err error) {
|
||||||
merchantObj, err := dao.GetStoreInfoByMerchantID(dao.GetDB(), "", order.JxStoreID, "", "")
|
var db = dao.GetDB()
|
||||||
|
merchantObj, err := dao.GetStoreInfoByMerchantID(db, "", order.JxStoreID, "", "")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@@ -101,9 +102,31 @@ func pay4OrderByLaKaLa(ctx *jxcontext.Context, order *model.GoodsOrder, payType
|
|||||||
fields, _ := json.Marshal(result.AccRespFields)
|
fields, _ := json.Marshal(result.AccRespFields)
|
||||||
orderPay.CodeURL = utils.LimitUTF8StringLen(string(fields), 3200)
|
orderPay.CodeURL = utils.LimitUTF8StringLen(string(fields), 3200)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
separate := &model.LakalaSeparateAmt{
|
||||||
|
MerchantNo: merchantObj.MerchantNo2,
|
||||||
|
VendorOrderID: order.VendorOrderID,
|
||||||
|
StoreId: order.JxStoreID,
|
||||||
|
CmdType: lakala.SeparateType_SEPATRATE,
|
||||||
|
Status: "1",
|
||||||
|
LogNo: result.LogNo,
|
||||||
|
LogDate: time.Now(),
|
||||||
|
OutSeparateNo: "",
|
||||||
|
SeparateNo: "",
|
||||||
|
CalType: "",
|
||||||
|
FinishDate: "",
|
||||||
|
TotalAmt: "",
|
||||||
|
ActualSeparateAmt: "",
|
||||||
|
TotalFeeAmt: "",
|
||||||
|
FinalStatus: "",
|
||||||
|
DetailData: "",
|
||||||
|
Remark: "聚合主扫订单",
|
||||||
|
}
|
||||||
|
dao.WrapAddIDCULEntity(separate, ctx.GetUserName())
|
||||||
|
dao.CreateEntity(db, separate)
|
||||||
}
|
}
|
||||||
order.VendorOrderID2 = result.LogNo
|
order.VendorOrderID2 = result.LogNo
|
||||||
dao.UpdateEntity(dao.GetDB(), order, "VendorOrderID2")
|
dao.UpdateEntity(db, order, "VendorOrderID2")
|
||||||
|
|
||||||
return orderPay, err
|
return orderPay, err
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -552,12 +552,13 @@ func (c *LaKaLaController) SeparateUnBind() {
|
|||||||
// @Param merchantNo query string true "商户号"
|
// @Param merchantNo query string true "商户号"
|
||||||
// @Param logDate query string true "拉卡拉对账单交易日期[yyyyMMdd]"
|
// @Param logDate query string true "拉卡拉对账单交易日期[yyyyMMdd]"
|
||||||
// @Param logNo query string true "交易流水号"
|
// @Param logNo query string true "交易流水号"
|
||||||
|
// @Param vendorOrderId query string true "京西订单号"
|
||||||
// @Success 200 {object} controllers.CallResult
|
// @Success 200 {object} controllers.CallResult
|
||||||
// @Failure 200 {object} controllers.CallResult
|
// @Failure 200 {object} controllers.CallResult
|
||||||
// @router /SeparateQueryAmt [get]
|
// @router /SeparateQueryAmt [get]
|
||||||
func (c *LaKaLaController) SeparateQueryAmt() {
|
func (c *LaKaLaController) SeparateQueryAmt() {
|
||||||
c.callSeparateQueryAmt(func(params *tLakalaSeparateQueryAmtParams) (retVal interface{}, errCode string, err error) {
|
c.callSeparateQueryAmt(func(params *tLakalaSeparateQueryAmtParams) (retVal interface{}, errCode string, err error) {
|
||||||
retVal, err = lakalaServer.SeparateQueryAmt(params.MerchantNo, params.LogDate, params.LogNo)
|
retVal, err = lakalaServer.SeparateQueryAmt(params.MerchantNo, params.LogDate, params.LogNo, params.VendorOrderId)
|
||||||
return
|
return
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@@ -567,6 +568,7 @@ func (c *LaKaLaController) SeparateQueryAmt() {
|
|||||||
// @Description 分账
|
// @Description 分账
|
||||||
// @Param token header string true "认证token"
|
// @Param token header string true "认证token"
|
||||||
// @Param payload formData string true "json数据,lakala.OrderSeparateReq 对象"
|
// @Param payload formData string true "json数据,lakala.OrderSeparateReq 对象"
|
||||||
|
// @Param vendorOrderId formData string true "京西订单号"
|
||||||
// @Success 200 {object} controllers.CallResult
|
// @Success 200 {object} controllers.CallResult
|
||||||
// @Failure 200 {object} controllers.CallResult
|
// @Failure 200 {object} controllers.CallResult
|
||||||
// @router /SeparateAmt [post]
|
// @router /SeparateAmt [post]
|
||||||
@@ -578,11 +580,7 @@ func (c *LaKaLaController) SeparateAmt() {
|
|||||||
return nil, "", err
|
return nil, "", err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
status, separateNo, err := lakalaServer.Separate(params.Ctx, amt)
|
retVal, err = lakalaServer.Separate(params.Ctx, amt, params.VendorOrderId)
|
||||||
if err != nil {
|
|
||||||
return nil, "", err
|
|
||||||
}
|
|
||||||
retVal = map[string]string{"status": status, "separateNo": separateNo}
|
|
||||||
return
|
return
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@@ -816,7 +814,7 @@ func (c *LaKaLaController) UploadAttachmentImg() {
|
|||||||
// @Title 进件查询
|
// @Title 进件查询
|
||||||
// @Description 进件查询
|
// @Description 进件查询
|
||||||
// @Param token header string true "认证token"
|
// @Param token header string true "认证token"
|
||||||
// @Param merchantNo query string false` "商户号"
|
// @Param merchantNo query string false "商户号"
|
||||||
// @Param storeID query int false "门店ID"
|
// @Param storeID query int false "门店ID"
|
||||||
// @Param offset query int false "列表起始序号(以0开始,缺省为0)"
|
// @Param offset query int false "列表起始序号(以0开始,缺省为0)"
|
||||||
// @Param pageSize query int false "列表页大小(缺省为50,-1表示全部)"
|
// @Param pageSize query int false "列表页大小(缺省为50,-1表示全部)"
|
||||||
@@ -834,7 +832,7 @@ func (c *LaKaLaController) QueryIncoming() {
|
|||||||
// @Title 分账账户查询
|
// @Title 分账账户查询
|
||||||
// @Description 分账账户查询
|
// @Description 分账账户查询
|
||||||
// @Param token header string true "认证token"
|
// @Param token header string true "认证token"
|
||||||
// @Param OrgCode query string false` "申请机构代码"
|
// @Param OrgCode query string false "申请机构代码"
|
||||||
// @Param ReceiverNo query string false "接收方编号"
|
// @Param ReceiverNo query string false "接收方编号"
|
||||||
// @Param ReceiverName query string false "接收方名称"
|
// @Param ReceiverName query string false "接收方名称"
|
||||||
// @Param offset query int true "列表起始序号(以0开始,缺省为0)"
|
// @Param offset query int true "列表起始序号(以0开始,缺省为0)"
|
||||||
@@ -853,12 +851,14 @@ func (c *LaKaLaController) GetRecipient() {
|
|||||||
// @Title 分账记录查询
|
// @Title 分账记录查询
|
||||||
// @Description 分账记录查询
|
// @Description 分账记录查询
|
||||||
// @Param token header string true "认证token"
|
// @Param token header string true "认证token"
|
||||||
// @Param merchantNo query string false` "商户号"
|
// @Param merchantNo query string false "商户号"
|
||||||
// @Param cmdType query string false` "流水类型[SEPARATE:分账 CANCEL:分账撤销FALLBACK:分账回退]"
|
// @Param cmdType query string false "流水类型[SEPARATE:分账 CANCEL:分账撤销FALLBACK:分账回退]"
|
||||||
// @Param status query string false` "分账状态"
|
// @Param status query string false "分账状态"
|
||||||
// @Param separateNo query string false` "分账流水号"
|
// @Param separateNo query string false "分账流水号"
|
||||||
// @Param separateTimeStart query string false` "开始交易时间[yyyy-mm-dd hh:mm:ss]"
|
// @Param separateTimeStart query string false "开始交易时间[yyyy-mm-dd hh:mm:ss]"
|
||||||
// @Param separateTimeEnd query string false` "结束交易时间[yyyy-mm-dd hh:mm:ss]"
|
// @Param separateTimeEnd query string false "结束交易时间[yyyy-mm-dd hh:mm:ss]"
|
||||||
|
// @Param vendorOrderId query string false "订单ID"
|
||||||
|
// @Param storeId query int false "门店ID"
|
||||||
// @Param offset query int true "列表起始序号(以0开始,缺省为0)"
|
// @Param offset query int true "列表起始序号(以0开始,缺省为0)"
|
||||||
// @Param pageSize query int true "列表页大小(缺省为50,-1表示全部)"
|
// @Param pageSize query int true "列表页大小(缺省为50,-1表示全部)"
|
||||||
// @Success 200 {object} controllers.CallResult
|
// @Success 200 {object} controllers.CallResult
|
||||||
@@ -866,7 +866,7 @@ func (c *LaKaLaController) GetRecipient() {
|
|||||||
// @router /GetSeparateAmt [get]
|
// @router /GetSeparateAmt [get]
|
||||||
func (c *LaKaLaController) GetSeparateAmt() {
|
func (c *LaKaLaController) GetSeparateAmt() {
|
||||||
c.callGetSeparateAmt(func(params *tLakalaGetSeparateAmtParams) (retVal interface{}, errCode string, err error) {
|
c.callGetSeparateAmt(func(params *tLakalaGetSeparateAmtParams) (retVal interface{}, errCode string, err error) {
|
||||||
retVal, err = lakalaServer.GetSeparateAmt(params.MerchantNo, params.CmdType, params.Status, params.SeparateNo, params.SeparateTimeStart, params.SeparateTimeEnd, params.Offset, params.PageSize)
|
retVal, err = lakalaServer.GetSeparateAmt(params.MerchantNo, params.CmdType, params.Status, params.SeparateNo, params.SeparateTimeStart, params.SeparateTimeEnd, params.VendorOrderId, params.StoreId, params.Offset, params.PageSize)
|
||||||
return
|
return
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@@ -875,12 +875,12 @@ func (c *LaKaLaController) GetSeparateAmt() {
|
|||||||
// @Title 提现流水查询
|
// @Title 提现流水查询
|
||||||
// @Description 提现流水查询
|
// @Description 提现流水查询
|
||||||
// @Param token header string true "认证token"
|
// @Param token header string true "认证token"
|
||||||
// @Param merchantNo query string false` "商户号"
|
// @Param merchantNo query string false "商户号"
|
||||||
// @Param drawJnl query string false` "订单号"
|
// @Param drawJnl query string false "订单号"
|
||||||
// @Param acctName query string false` "账户名"
|
// @Param acctName query string false "账户名"
|
||||||
// @Param startTime query string false` "开始交易时间[yyyy-mm-dd hh:mm:ss]"
|
// @Param startTime query string false "开始交易时间[yyyy-mm-dd hh:mm:ss]"
|
||||||
// @Param endTime query string false` "结束交易时间[yyyy-mm-dd hh:mm:ss]"
|
// @Param endTime query string false "结束交易时间[yyyy-mm-dd hh:mm:ss]"
|
||||||
// @Param separateNo query string false` "分账流水号"
|
// @Param separateNo query string false "分账流水号"
|
||||||
// @Param offset query int true "列表起始序号(以0开始,缺省为0)"
|
// @Param offset query int true "列表起始序号(以0开始,缺省为0)"
|
||||||
// @Param pageSize query int true "列表页大小(缺省为50,-1表示全部)"
|
// @Param pageSize query int true "列表页大小(缺省为50,-1表示全部)"
|
||||||
// @Success 200 {object} controllers.CallResult
|
// @Success 200 {object} controllers.CallResult
|
||||||
|
|||||||
Reference in New Issue
Block a user