|
|
@@ -152,6 +152,36 @@ func GetGzhPayData(openid, outTradeNo string, totalPrice int64, body, notifyUrl,
|
|
|
|
|
|
}
|
|
|
|
|
|
+// 获取jsSDK微信支付需要的数据
|
|
|
+func GetRefundDataPay(outTradeNo, outRefundNo string, totalPrice int64, transactionId, remark string) (ret map[string]string) {
|
|
|
+ outTradeNo = fmt.Sprintf("%s_%d", outTradeNo, time.Now().Unix())
|
|
|
+ u := uuid.NewV4().String()
|
|
|
+ us := strings.Split(u, "-")
|
|
|
+ nonce_str := strings.Join(us, "")
|
|
|
+ req := map[string]string{
|
|
|
+ "mch_id": gzhMchId,
|
|
|
+ "appid": gzhAppId,
|
|
|
+ "nonce_str": nonce_str, //fmt.Sprintf("%d", time.Now().Unix()),
|
|
|
+ "transaction_id": transactionId,
|
|
|
+ "out_trade_no": outTradeNo,
|
|
|
+ "out_refund_no": outRefundNo,
|
|
|
+ "total_fee": fmt.Sprintf("%d", totalPrice), //分为单位,订单总金额
|
|
|
+ "refund_fee": fmt.Sprintf("%d", totalPrice), //分为单位,退款总金额
|
|
|
+ //"notify_url": notifyUrl,
|
|
|
+ "refund_desc": remark,
|
|
|
+ }
|
|
|
+ sign := mch.Sign(req, gzhApiKey, nil)
|
|
|
+ req["sign"] = sign
|
|
|
+ beego.BeeLogger.Warn("%v", req)
|
|
|
+ ret, err := pay.Refund(gzhMchProxy, req)
|
|
|
+ if err != nil {
|
|
|
+ beego.BeeLogger.Error("getGzhPayPrepayId err[%s]", err)
|
|
|
+ //fmt.Println(err)
|
|
|
+ return nil
|
|
|
+ }
|
|
|
+ return ret
|
|
|
+}
|
|
|
+
|
|
|
// 获取支付预授权码
|
|
|
// [pay.go:76] [E] GetPrepayId err[return_code: "FAIL", return_msg: "不识别的参数wxappid"]
|
|
|
// 2016/07/07 11:07:02 [pay_controller.go:303] [W] 生成微信支付订单号:DS20160707503D648C,传的参数:openid=o7lR2txmVPh1pSPjIvto2LO_XVYU,
|