|
@@ -3,6 +3,7 @@ package pay |
|
|
import ( |
|
|
import ( |
|
|
"code.fnuoos.com/go_rely_warehouse/zyos_go_pay.git/md" |
|
|
"code.fnuoos.com/go_rely_warehouse/zyos_go_pay.git/md" |
|
|
zhios_pay_utils "code.fnuoos.com/go_rely_warehouse/zyos_go_pay.git/utils" |
|
|
zhios_pay_utils "code.fnuoos.com/go_rely_warehouse/zyos_go_pay.git/utils" |
|
|
|
|
|
"crypto/tls" |
|
|
"io/ioutil" |
|
|
"io/ioutil" |
|
|
"net/http" |
|
|
"net/http" |
|
|
"net/url" |
|
|
"net/url" |
|
@@ -17,19 +18,27 @@ func UniPayByJoin(payParams *md.JoinPayReq, paySecretKey string,isPrd bool) (*md |
|
|
payParams.P3Amount = "0.1" |
|
|
payParams.P3Amount = "0.1" |
|
|
payParams.P5ProductName = "测试商品" |
|
|
payParams.P5ProductName = "测试商品" |
|
|
payParams.P9NotifyUrl = "AB|https://www.baidu.com" |
|
|
payParams.P9NotifyUrl = "AB|https://www.baidu.com" |
|
|
//--交易类型//payParams.Q1FrpCode = md.Q1FrpCodeWEIXINPAYH5 |
|
|
|
|
|
payParams.Q1FrpCode = md.Q1FrpCodeALIPAY |
|
|
|
|
|
//原始微信AppId//payParams.Q7AppId = "gh_5a236de9850a" |
|
|
|
|
|
//微信AppId//payParams.Q7AppId = "wx5bb10bb79cb5da1c" |
|
|
|
|
|
|
|
|
//--交易类型 |
|
|
|
|
|
payParams.Q1FrpCode = md.Q1FrpCodeWEIXINPAYAPP |
|
|
|
|
|
//payParams.Q1FrpCode = md.Q1FrpCodeALIPAY |
|
|
|
|
|
//原始微信AppId |
|
|
|
|
|
//payParams.Q7AppId = "gh_5a236de9850a" |
|
|
|
|
|
//微信AppId |
|
|
|
|
|
payParams.Q7AppId = "wx5bb10bb79cb5da1c" |
|
|
//商家报备编号(分微信和支付宝的);支付宝的: |
|
|
//商家报备编号(分微信和支付宝的);支付宝的: |
|
|
payParams.QATradeMerchantNo = md.PayTestAliAccount |
|
|
|
|
|
//商家报备编号(分微信和支付宝的);微信的://payParams.QATradeMerchantNo = md.PayTestWeChatAccount |
|
|
|
|
|
|
|
|
//payParams.QATradeMerchantNo = md.PayTestAliAccount |
|
|
|
|
|
//商家报备编号(分微信和支付宝的);微信的: |
|
|
|
|
|
payParams.QATradeMerchantNo = md.PayTestWeChatAccount |
|
|
postData := url.Values{} |
|
|
postData := url.Values{} |
|
|
creatHmac(payParams,paySecretKey, &postData) |
|
|
creatHmac(payParams,paySecretKey, &postData) |
|
|
zhios_pay_utils.FilePutContents("UniPayByJoin", zhios_pay_utils.SerializeStr(map[string]interface{}{ |
|
|
zhios_pay_utils.FilePutContents("UniPayByJoin", zhios_pay_utils.SerializeStr(map[string]interface{}{ |
|
|
"data": payParams, |
|
|
"data": payParams, |
|
|
})) |
|
|
})) |
|
|
response, err := http.Post(md.JoinPayUrl, "application/x-www-form-urlencoded", strings.NewReader(postData.Encode())) |
|
|
|
|
|
|
|
|
tr := &http.Transport{ |
|
|
|
|
|
TLSClientConfig: &tls.Config{InsecureSkipVerify: true}, |
|
|
|
|
|
} |
|
|
|
|
|
client := &http.Client{Transport: tr} |
|
|
|
|
|
response, err := client.Post(md.JoinPayUrl, "application/x-www-form-urlencoded", strings.NewReader(postData.Encode())) |
|
|
if err != nil { |
|
|
if err != nil { |
|
|
return nil, err |
|
|
return nil, err |
|
|
} |
|
|
} |
|
|