|
|
@@ -3,7 +3,6 @@ package svc |
|
|
|
import ( |
|
|
|
"applet/app/admin/md" |
|
|
|
svc "applet/app/admin/svc/enterprise_manage" |
|
|
|
"applet/app/cfg" |
|
|
|
enum2 "applet/app/customer/enum" |
|
|
|
md2 "applet/app/customer/md" |
|
|
|
svc2 "applet/app/customer/svc" |
|
|
@@ -299,36 +298,36 @@ func CentralKitchenForSchoolOrderRefundAudit(c *gin.Context, req md.CentralKitch |
|
|
|
} |
|
|
|
|
|
|
|
//调用微信进行退款 |
|
|
|
if !cfg.Prd { //TODO::正式环境暂不开启微信退款 |
|
|
|
client, err1 := svc3.NewWxPayClient(c) //初始化微信连接 |
|
|
|
if err1 != nil { |
|
|
|
_ = session.Rollback() |
|
|
|
return err1 |
|
|
|
} |
|
|
|
wxSvc := refunddomestic.RefundsApiService{Client: client} |
|
|
|
for k, v := range dealReturnOrdMapForWx { |
|
|
|
resp, _, err6 := wxSvc.Create(c, |
|
|
|
refunddomestic.CreateRequest{ |
|
|
|
SubMchid: core.String(sysCfg[enum.WxMchId]), |
|
|
|
OutTradeNo: core.String(k), |
|
|
|
OutRefundNo: core.String(v.OutRequestNo), |
|
|
|
Reason: core.String("央厨订餐退款"), |
|
|
|
NotifyUrl: core.String(sysCfg[enum.WxJsapiRefundPayNotifyUrl]), |
|
|
|
Amount: &refunddomestic.AmountReq{ |
|
|
|
Currency: core.String("CNY"), |
|
|
|
Refund: core.Int64(int64(math.Round(v.Amount * 100))), |
|
|
|
Total: core.Int64(int64(math.Round(utils.StrToFloat64(v.Total) * 100))), |
|
|
|
}, |
|
|
|
//if !cfg.Prd { //TODO::正式环境暂不开启微信退款 |
|
|
|
client, err1 := svc3.NewWxPayClient(c) //初始化微信连接 |
|
|
|
if err1 != nil { |
|
|
|
_ = session.Rollback() |
|
|
|
return err1 |
|
|
|
} |
|
|
|
wxSvc := refunddomestic.RefundsApiService{Client: client} |
|
|
|
for k, v := range dealReturnOrdMapForWx { |
|
|
|
resp, _, err6 := wxSvc.Create(c, |
|
|
|
refunddomestic.CreateRequest{ |
|
|
|
SubMchid: core.String(sysCfg[enum.WxMchId]), |
|
|
|
OutTradeNo: core.String(k), |
|
|
|
OutRefundNo: core.String(v.OutRequestNo), |
|
|
|
Reason: core.String("央厨订餐退款"), |
|
|
|
NotifyUrl: core.String(sysCfg[enum.WxJsapiRefundPayNotifyUrl]), |
|
|
|
Amount: &refunddomestic.AmountReq{ |
|
|
|
Currency: core.String("CNY"), |
|
|
|
Refund: core.Int64(int64(math.Round(v.Amount * 100))), |
|
|
|
Total: core.Int64(int64(math.Round(utils.StrToFloat64(v.Total) * 100))), |
|
|
|
}, |
|
|
|
) |
|
|
|
if err6 != nil { |
|
|
|
_ = session.Rollback() |
|
|
|
return err6 |
|
|
|
} |
|
|
|
fmt.Println(">>>>wxRefund<<<<", resp.Status) |
|
|
|
time.Sleep(20 * time.Millisecond) //TODO::避免频繁调用 |
|
|
|
}, |
|
|
|
) |
|
|
|
if err6 != nil { |
|
|
|
_ = session.Rollback() |
|
|
|
return err6 |
|
|
|
} |
|
|
|
fmt.Println(">>>>wxRefund<<<<", resp.Status) |
|
|
|
time.Sleep(200 * time.Millisecond) //TODO::避免频繁调用 |
|
|
|
} |
|
|
|
//} |
|
|
|
|
|
|
|
session.Commit() |
|
|
|
|
|
|
|