通联宝支付测试
This commit is contained in:
@@ -34,8 +34,9 @@ func pay4OrderByTL(ctx *jxcontext.Context, order *model.GoodsOrder, vendorPayTyp
|
||||
}
|
||||
result, err := api.TLpayAPI.CreateUnitorderOrder(param)
|
||||
if err == nil {
|
||||
result2 := &tonglianpayapi.PayInfo{}
|
||||
var result2 tonglianpayapi.PayInfo
|
||||
json.Unmarshal([]byte(result.PayInfo), &result2)
|
||||
globals.SugarLogger.Debugf("pay4OrderByTL, [%v]", result2)
|
||||
orderPay = &model.OrderPay{
|
||||
PayOrderID: param.Reqsn,
|
||||
PayType: model.PayTypeTL,
|
||||
@@ -55,6 +56,7 @@ func pay4OrderByTL(ctx *jxcontext.Context, order *model.GoodsOrder, vendorPayTyp
|
||||
result.PayInfo = string(str)
|
||||
err = err2
|
||||
}
|
||||
globals.SugarLogger.Debugf("pay4OrderByTL2, [%v]", *result)
|
||||
return orderPay, err
|
||||
}
|
||||
|
||||
@@ -148,3 +150,25 @@ func onTLpayRefund(call *tonglianpayapi.CallBackResult) (err error) {
|
||||
// }
|
||||
return err
|
||||
}
|
||||
|
||||
func refundOrderByTL(ctx *jxcontext.Context, orderPay *model.OrderPay, refundID string, refundFee int, refundDesc string) (orderPayRefund *model.OrderPayRefund, err error) {
|
||||
result, err := api.TLpayAPI.PayRefund(&tonglianpayapi.PayRefundParam{
|
||||
Trxamt: orderPay.TotalFee,
|
||||
Reqsn: refundID,
|
||||
OldReqsn: orderPay.VendorOrderID,
|
||||
Remark: refundDesc,
|
||||
})
|
||||
if err == nil {
|
||||
orderPayRefund = &model.OrderPayRefund{
|
||||
RefundID: refundID,
|
||||
VendorRefundID: result.TrxID,
|
||||
VendorOrderID: orderPay.VendorOrderID,
|
||||
VendorID: orderPay.VendorID,
|
||||
Status: model.RefundStatusNo,
|
||||
TransactionID: orderPay.TransactionID,
|
||||
RefundFee: orderPay.TotalFee,
|
||||
RefundCreatedAt: time.Now(),
|
||||
}
|
||||
}
|
||||
return orderPayRefund, err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user