|
@@ -9,7 +9,7 @@ import ( |
|
|
"strings" |
|
|
"strings" |
|
|
) |
|
|
) |
|
|
|
|
|
|
|
|
func UniPayByJoin(payParams *md.JoinPayReq, isPrd bool) (map[string]interface{}, error) { |
|
|
|
|
|
|
|
|
func UniPayByJoin(payParams *md.JoinPayReq, paySecretKey string,isPrd bool) (map[string]interface{}, error) { |
|
|
payParams.P0Version = "2.1" |
|
|
payParams.P0Version = "2.1" |
|
|
//payParams.P1MerchantNo = md.PayTestAccount |
|
|
//payParams.P1MerchantNo = md.PayTestAccount |
|
|
payParams.P4Cur = "1" |
|
|
payParams.P4Cur = "1" |
|
@@ -24,7 +24,7 @@ func UniPayByJoin(payParams *md.JoinPayReq, isPrd bool) (map[string]interface{}, |
|
|
//商家报备编号(分微信和支付宝的);支付宝的://payParams.QATradeMerchantNo = md.PayTestAliAccount |
|
|
//商家报备编号(分微信和支付宝的);支付宝的://payParams.QATradeMerchantNo = md.PayTestAliAccount |
|
|
//商家报备编号(分微信和支付宝的);微信的://payParams.QATradeMerchantNo = md.PayTestWeChatAccount |
|
|
//商家报备编号(分微信和支付宝的);微信的://payParams.QATradeMerchantNo = md.PayTestWeChatAccount |
|
|
postData := url.Values{} |
|
|
postData := url.Values{} |
|
|
creatHmac(payParams, &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, |
|
|
})) |
|
|
})) |
|
@@ -39,7 +39,7 @@ func UniPayByJoin(payParams *md.JoinPayReq, isPrd bool) (map[string]interface{}, |
|
|
return resp, err |
|
|
return resp, err |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
func creatHmac(payParams *md.JoinPayReq, postData *url.Values) { |
|
|
|
|
|
|
|
|
func creatHmac(payParams *md.JoinPayReq,paySecretKey string, postData *url.Values) { |
|
|
hmac := "" |
|
|
hmac := "" |
|
|
if payParams.P0Version != "" { |
|
|
if payParams.P0Version != "" { |
|
|
postData.Add("p0_Version", payParams.P0Version) |
|
|
postData.Add("p0_Version", payParams.P0Version) |
|
@@ -129,6 +129,6 @@ func creatHmac(payParams *md.JoinPayReq, postData *url.Values) { |
|
|
postData.Add("ql_TerminalIp", payParams.QLTerminalIp) |
|
|
postData.Add("ql_TerminalIp", payParams.QLTerminalIp) |
|
|
hmac = hmac + payParams.QLTerminalIp |
|
|
hmac = hmac + payParams.QLTerminalIp |
|
|
} |
|
|
} |
|
|
payParams.Hmac = zhios_pay_utils.Md5(hmac + md.PayTestSecretKey) |
|
|
|
|
|
|
|
|
payParams.Hmac = zhios_pay_utils.Md5(hmac + paySecretKey) |
|
|
postData.Add("hmac", payParams.Hmac) |
|
|
postData.Add("hmac", payParams.Hmac) |
|
|
} |
|
|
} |