From da1e4a7b09af8bb84cc8915336f7d812cc63e935 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8B=8F=E5=B0=B9=E5=B2=9A?= <770236076@qq.com> Date: Thu, 27 Feb 2020 12:42:25 +0800 Subject: [PATCH] =?UTF-8?q?=E9=80=9A=E8=81=94=E5=AE=9D=E6=94=AF=E4=BB=98?= =?UTF-8?q?=E6=B5=8B=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../purchase/jx/localjx/tonglianpay.go | 26 ++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/business/partner/purchase/jx/localjx/tonglianpay.go b/business/partner/purchase/jx/localjx/tonglianpay.go index 462ddf57e..a4e9c81ee 100644 --- a/business/partner/purchase/jx/localjx/tonglianpay.go +++ b/business/partner/purchase/jx/localjx/tonglianpay.go @@ -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 +}