|
@@ -56,7 +56,7 @@ const (
|
|
|
PAY_OPTION_CHECK = "OPTION_CHECK"
|
|
PAY_OPTION_CHECK = "OPTION_CHECK"
|
|
|
)
|
|
)
|
|
|
|
|
|
|
|
-//小程序端微信支付client
|
|
|
|
|
|
|
+// 小程序端微信支付client
|
|
|
func getMchProxyInitClient(payCode, source string) *mch.Proxy {
|
|
func getMchProxyInitClient(payCode, source string) *mch.Proxy {
|
|
|
mechant := GetMechantInfo(payCode)
|
|
mechant := GetMechantInfo(payCode)
|
|
|
appId := ""
|
|
appId := ""
|
|
@@ -115,14 +115,22 @@ type PayResult struct {
|
|
|
CashFeeType string `xml:"cash_fee_type"` //现金支付货币类型
|
|
CashFeeType string `xml:"cash_fee_type"` //现金支付货币类型
|
|
|
CouponFee string `xml:"coupon_fee"` //提货券或立减优惠金额
|
|
CouponFee string `xml:"coupon_fee"` //提货券或立减优惠金额
|
|
|
CouponCount string `xml:"coupon_count"` //提货券或立减优惠使用数量
|
|
CouponCount string `xml:"coupon_count"` //提货券或立减优惠使用数量
|
|
|
- CouponFee0 string `xml:"coupon_fee_0"` //单个提货券支付金额,$n为下标,从0开始编号
|
|
|
|
|
- CouponId0 string `xml:"coupon_id_0"` //提货券ID,$n为下标,从0开始编号
|
|
|
|
|
- TransactionId string `xml:"transaction_id"` //微信支付订单号
|
|
|
|
|
- OutTradeNO string `xml:"out_trade_no"` //商户订单号
|
|
|
|
|
- Attach string `xml:"attach"` // 商家数据包
|
|
|
|
|
- TimeEnd string `xml:"time_end"` // 支付完成时间 yyyyMMddHHmmss
|
|
|
|
|
|
|
+
|
|
|
|
|
+ TransactionId string `xml:"transaction_id"` //微信支付订单号
|
|
|
|
|
+ OutTradeNO string `xml:"out_trade_no"` //商户订单号
|
|
|
|
|
+ Attach string `xml:"attach"` // 商家数据包
|
|
|
|
|
+ TimeEnd string `xml:"time_end"` // 支付完成时间 yyyyMMddHHmmss
|
|
|
//coupon_id_$n
|
|
//coupon_id_$n
|
|
|
//coupon_fee_$na
|
|
//coupon_fee_$na
|
|
|
|
|
+ //新增 coupon_fee
|
|
|
|
|
+ CouponFee0 string `xml:"coupon_fee_0"` //单个提货券支付金额,$n为下标,从0开始编号
|
|
|
|
|
+ CouponId0 string `xml:"coupon_id_0"` //提货券ID,$n为下标,从0开始编号
|
|
|
|
|
+ CouponFee1 string `xml:"coupon_fee_1"` //单个提货券支付金额,$n为下标,从0开始编号
|
|
|
|
|
+ CouponId1 string `xml:"coupon_id_1"` //提货券ID,$n为下标,从0开始编号
|
|
|
|
|
+ CouponFee2 string `xml:"coupon_fee_2"` //单个提货券支付金额,$n为下标,从0开始编号
|
|
|
|
|
+ CouponId2 string `xml:"coupon_id_2"` //提货券ID,$n为下标,从0开始编号
|
|
|
|
|
+ CouponFee3 string `xml:"coupon_fee_3"` //单个提货券支付金额,$n为下标,从0开始编号
|
|
|
|
|
+ CouponId3 string `xml:"coupon_id_3"` //提货券ID,$n为下标,从0开始编号
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
// 获取jsSDK微信支付需要的数据
|
|
// 获取jsSDK微信支付需要的数据
|
|
@@ -192,7 +200,9 @@ func GetAppPayData(outTradeNo string, totalPrice int64, body, notifyUrl, remoteI
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
// 获取支付预授权码
|
|
// 获取支付预授权码
|
|
|
-// [pay.go:76] [E] GetPrepayId err[return_code: "FAIL", return_msg: "不识别的参数wxappid"]
|
|
|
|
|
|
|
+//
|
|
|
|
|
+// [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,
|
|
// 2016/07/07 11:07:02 [pay_controller.go:303] [W] 生成微信支付订单号:DS20160707503D648C,传的参数:openid=o7lR2txmVPh1pSPjIvto2LO_XVYU,
|
|
|
// 价格:9.90, 名称:希客购, 客户端IP=119.132.31.240;生成的参数:%!v(MISSING)
|
|
// 价格:9.90, 名称:希客购, 客户端IP=119.132.31.240;生成的参数:%!v(MISSING)
|
|
|
func getAppPayPrepayId(outTradeNo string, totalPrice int64, body, notifyUrl, remoteIp, payCode string, limit bool) (prepayId string) {
|
|
func getAppPayPrepayId(outTradeNo string, totalPrice int64, body, notifyUrl, remoteIp, payCode string, limit bool) (prepayId string) {
|
|
@@ -252,7 +262,9 @@ func GetPayData(openid, outTradeNo string, totalPrice int64, body, notifyUrl, re
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
// 获取支付预授权码
|
|
// 获取支付预授权码
|
|
|
-// [pay.go:76] [E] GetPrepayId err[return_code: "FAIL", return_msg: "不识别的参数wxappid"]
|
|
|
|
|
|
|
+//
|
|
|
|
|
+// [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,
|
|
// 2016/07/07 11:07:02 [pay_controller.go:303] [W] 生成微信支付订单号:DS20160707503D648C,传的参数:openid=o7lR2txmVPh1pSPjIvto2LO_XVYU,
|
|
|
// 价格:9.90, 名称:希客购, 客户端IP=119.132.31.240;生成的参数:%!v(MISSING)
|
|
// 价格:9.90, 名称:希客购, 客户端IP=119.132.31.240;生成的参数:%!v(MISSING)
|
|
|
func getPayPrepayId(openid, outTradeNo string, totalPrice int64, body, notifyUrl, remoteIp, payCode string, limit bool) (prepayId string) {
|
|
func getPayPrepayId(openid, outTradeNo string, totalPrice int64, body, notifyUrl, remoteIp, payCode string, limit bool) (prepayId string) {
|
|
@@ -294,7 +306,7 @@ func getPayPrepayId(openid, outTradeNo string, totalPrice int64, body, notifyUrl
|
|
|
return ret["prepay_id"]
|
|
return ret["prepay_id"]
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-//订单退款接口
|
|
|
|
|
|
|
+// 订单退款接口
|
|
|
func GetRefundDataPay(outTradeNo, outRefundNo string, totalPrice int64, transactionId, remark, payCode string) (ret map[string]string) {
|
|
func GetRefundDataPay(outTradeNo, outRefundNo string, totalPrice int64, transactionId, remark, payCode string) (ret map[string]string) {
|
|
|
outTradeNo = fmt.Sprintf("%s_%d", outTradeNo, time.Now().Unix())
|
|
outTradeNo = fmt.Sprintf("%s_%d", outTradeNo, time.Now().Unix())
|
|
|
appId := beego.AppConfig.String("WxFohowXcxAppId") //获取小程序渠道appId
|
|
appId := beego.AppConfig.String("WxFohowXcxAppId") //获取小程序渠道appId
|
|
@@ -337,10 +349,11 @@ func getTradeNo(prefix string) string {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
// 企业付款
|
|
// 企业付款
|
|
|
-// NO_CHECK:不校验真实姓名
|
|
|
|
|
-// FORCE_CHECK:强校验真实姓名(未实名认证的用户会校验失败,无法转账)
|
|
|
|
|
-// OPTION_CHECK:针对已实名认证的用户才校验真实姓名(未实名认证用户不校验,可以转账成功)
|
|
|
|
|
-// 如果check_name设置为FORCE_CHECK或OPTION_CHECK,则必填用户真实姓名
|
|
|
|
|
|
|
+//
|
|
|
|
|
+// NO_CHECK:不校验真实姓名
|
|
|
|
|
+// FORCE_CHECK:强校验真实姓名(未实名认证的用户会校验失败,无法转账)
|
|
|
|
|
+// OPTION_CHECK:针对已实名认证的用户才校验真实姓名(未实名认证用户不校验,可以转账成功)
|
|
|
|
|
+// 如果check_name设置为FORCE_CHECK或OPTION_CHECK,则必填用户真实姓名
|
|
|
func Transfers(openid string, rmb int64, tradeNo, check, realName, payCode, desc string) map[string]string {
|
|
func Transfers(openid string, rmb int64, tradeNo, check, realName, payCode, desc string) map[string]string {
|
|
|
// tradNo := getTradeNo("EP")
|
|
// tradNo := getTradeNo("EP")
|
|
|
appId := beego.AppConfig.String("WxFohowXcxAppId") //获取小程序渠道appId
|
|
appId := beego.AppConfig.String("WxFohowXcxAppId") //获取小程序渠道appId
|