通联宝支付测试

This commit is contained in:
苏尹岚
2020-02-27 12:42:25 +08:00
parent 36f588178d
commit da1e4a7b09

View File

@@ -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
}