|
|
@@ -9,19 +9,20 @@ import ( |
|
|
|
"strings" |
|
|
|
) |
|
|
|
|
|
|
|
func UniPayByJoin(payParams *md.JoinPayReq, paySecretKey string,isPrd bool) (map[string]interface{}, error) { |
|
|
|
func UniPayByJoin(payParams *md.JoinPayReq, paySecretKey string,isPrd bool) (*md.JoinPayResponse, error) { |
|
|
|
payParams.P0Version = "2.1" |
|
|
|
//payParams.P1MerchantNo = md.PayTestAccount |
|
|
|
payParams.P1MerchantNo = md.PayTestAccount |
|
|
|
payParams.P4Cur = "1" |
|
|
|
//payParams.P2OrderNo = "9527" |
|
|
|
//payParams.P3Amount = "10" |
|
|
|
//payParams.P5ProductName = "测试商品" |
|
|
|
//payParams.P9NotifyUrl = "AB|https://www.baidu.com" |
|
|
|
payParams.P2OrderNo = "95271" |
|
|
|
payParams.P3Amount = "0.1" |
|
|
|
payParams.P5ProductName = "测试商品" |
|
|
|
payParams.P9NotifyUrl = "AB|https://www.baidu.com" |
|
|
|
//--交易类型//payParams.Q1FrpCode = md.Q1FrpCodeWEIXINPAYH5 |
|
|
|
//payParams.Q1FrpCode = md.Q1FrpCodeALIPAY |
|
|
|
payParams.Q1FrpCode = md.Q1FrpCodeALIPAY |
|
|
|
//原始微信AppId//payParams.Q7AppId = "gh_5a236de9850a" |
|
|
|
//微信AppId//payParams.Q7AppId = "wx5bb10bb79cb5da1c" |
|
|
|
//商家报备编号(分微信和支付宝的);支付宝的://payParams.QATradeMerchantNo = md.PayTestAliAccount |
|
|
|
//商家报备编号(分微信和支付宝的);支付宝的: |
|
|
|
payParams.QATradeMerchantNo = md.PayTestAliAccount |
|
|
|
//商家报备编号(分微信和支付宝的);微信的://payParams.QATradeMerchantNo = md.PayTestWeChatAccount |
|
|
|
postData := url.Values{} |
|
|
|
creatHmac(payParams,paySecretKey, &postData) |
|
|
@@ -34,9 +35,9 @@ func UniPayByJoin(payParams *md.JoinPayReq, paySecretKey string,isPrd bool) (map |
|
|
|
} |
|
|
|
defer response.Body.Close() |
|
|
|
body, err := ioutil.ReadAll(response.Body) |
|
|
|
resp := make(map[string]interface{}) |
|
|
|
resp := md.JoinPayResponse{} |
|
|
|
zhios_pay_utils.Unserialize(body, &resp) |
|
|
|
return resp, err |
|
|
|
return &resp, err |
|
|
|
} |
|
|
|
|
|
|
|
func creatHmac(payParams *md.JoinPayReq,paySecretKey string, postData *url.Values) { |
|
|
|