|
|
@@ -4,6 +4,8 @@ import (
|
|
|
// "encoding/json"
|
|
|
"encoding/xml"
|
|
|
"fmt"
|
|
|
+ "fohow.com/apps/models/order_model"
|
|
|
+
|
|
|
// "io/ioutil"
|
|
|
// "net/http"
|
|
|
"reflect"
|
|
|
@@ -51,12 +53,18 @@ const (
|
|
|
)
|
|
|
|
|
|
//小程序端微信支付client
|
|
|
-func getMchProxyInitClient(payCode string) *mch.Proxy {
|
|
|
+func getMchProxyInitClient(payCode, source string) *mch.Proxy {
|
|
|
mechant := GetMechantInfo(payCode)
|
|
|
appId := beego.AppConfig.String("WxFohowXcxAppId") //获取小程序渠道appId
|
|
|
+ switch source {
|
|
|
+ case order_model.SOURCE_APP:
|
|
|
+ appId = beego.AppConfig.String("WxFohowAndroAppAppId") //获取小程序渠道appId
|
|
|
+ }
|
|
|
+
|
|
|
mchProxy := mch.NewProxy(appId, mechant.MchId, mechant.ApiKey, nil)
|
|
|
return mchProxy
|
|
|
}
|
|
|
+
|
|
|
func getMchTLSProxyInitClient(payCode string) *mch.Proxy {
|
|
|
appId := beego.AppConfig.String("WxFohowXcxAppId") //获取小程序渠道appId
|
|
|
mechant := GetMechantInfo(payCode)
|
|
|
@@ -165,7 +173,7 @@ func GetAppPayData(outTradeNo string, totalPrice int64, body, notifyUrl, remoteI
|
|
|
func getAppPayPrepayId(outTradeNo string, totalPrice int64, body, notifyUrl, remoteIp, payCode string, limit bool) (prepayId string) {
|
|
|
appId := beego.AppConfig.String("WxFohowAndroAppAppId") //获取App渠道appId
|
|
|
mechantInfo := GetMechantInfo(payCode) //商户号配置信息
|
|
|
- mchProxy := getMchProxyInitClient(payCode)
|
|
|
+ mchProxy := getMchProxyInitClient(payCode, order_model.SOURCE_APP)
|
|
|
|
|
|
outTradeNo = fmt.Sprintf("%s_%d", outTradeNo, time.Now().Unix())
|
|
|
u := uuid.NewV4().String()
|
|
|
@@ -228,7 +236,7 @@ func GetPayData(openid, outTradeNo string, totalPrice int64, body, notifyUrl, re
|
|
|
func getPayPrepayId(openid, outTradeNo string, totalPrice int64, body, notifyUrl, remoteIp, payCode string, limit bool) (prepayId string) {
|
|
|
appId := beego.AppConfig.String("WxFohowXcxAppId") //获取小程序渠道appId
|
|
|
mechantInfo := GetMechantInfo(payCode) //商户号配置信息
|
|
|
- mchProxy := getMchProxyInitClient(payCode)
|
|
|
+ mchProxy := getMchProxyInitClient(payCode, order_model.SOURCE_XCX)
|
|
|
|
|
|
outTradeNo = fmt.Sprintf("%s_%d", outTradeNo, time.Now().Unix())
|
|
|
u := uuid.NewV4().String()
|