wx cash
This commit is contained in:
@@ -70,6 +70,36 @@ func (p *PayHandler) CreateRefund() (err error) {
|
||||
switch p.PayType {
|
||||
case model.PayTypeTL:
|
||||
case model.PayTypeWX:
|
||||
//企业付款(提现)
|
||||
if p.VendorPayType == model.VendorPayTypeCompanyPay {
|
||||
param := &wxpayapi.TransfersParam{
|
||||
PartnerTradeNo: utils.Int64ToStr(p.Order.OrderID),
|
||||
CheckName: wxpayapi.CheckName,
|
||||
Amount: p.Order.PayPrice,
|
||||
Desc: "冲天猴儿app提现到账",
|
||||
SpbillCreateIP: p.Ctx.GetRealRemoteIP(),
|
||||
}
|
||||
if authInfo, err := p.Ctx.GetV2AuthInfo(); err == nil && authInfo.GetAuthType() == weixin.AuthTypeWxApp {
|
||||
param.OpenID = authInfo.GetAuthID()
|
||||
}
|
||||
result, err := api.WxpayAPI.Transfers(param)
|
||||
if err == nil {
|
||||
p.Order.PayFinishedAt = utils.Str2Time(result.PaymentTime)
|
||||
p.Order.Comment = result.DeviceInfo
|
||||
p.Order.OriginalData = utils.Format4Output(result, true)
|
||||
if result.ReturnMsg == "" {
|
||||
p.Order.Status = model.OrderStatusFinished
|
||||
} else {
|
||||
p.Order.Status = model.OrderStatusCanceled
|
||||
}
|
||||
dao.UpdateEntity(dao.GetDB(), p.Order)
|
||||
if result.ReturnMsg == "" {
|
||||
err = OnPayFinished(p.Order)
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
||||
}
|
||||
}
|
||||
return err
|
||||
}
|
||||
@@ -97,7 +127,7 @@ func onTLpayFinished(call *tonglianpayapi.CallBackResult) (err error) {
|
||||
}
|
||||
loc, _ := time.LoadLocation("Local")
|
||||
t1, _ := time.ParseInLocation("20060102150405", call.PayTime, loc)
|
||||
order.PayFinishedAt = utils.Time2Pointer(t1)
|
||||
order.PayFinishedAt = t1
|
||||
// order.TransactionID = call.ChnlTrxID
|
||||
order.OriginalData = utils.Format4Output(call, true)
|
||||
if call.TrxStatus == tonglianpayapi.TrxStatusSuccess {
|
||||
@@ -197,7 +227,7 @@ func onWxpayFinished(msg *wxpayapi.PayResultMsg) (err error) {
|
||||
}
|
||||
db := dao.GetDB()
|
||||
if err = dao.GetEntity(db, order, "OrderID"); err == nil {
|
||||
order.PayFinishedAt = utils.Time2Pointer(wxpayapi.PayTime2Time(msg.TimeEnd))
|
||||
order.PayFinishedAt = wxpayapi.PayTime2Time(msg.TimeEnd)
|
||||
order.TransactionID = msg.TransactionID
|
||||
order.OriginalData = utils.Format4Output(msg, true)
|
||||
if msg.ResultCode == wxpayapi.ResponseCodeSuccess {
|
||||
|
||||
Reference in New Issue
Block a user