Parcourir la source

汇聚支付-聚合支付

tags/v1.3.8
jiaoboxiang il y a 2 ans
Parent
révision
6e5c9f1505
1 fichiers modifiés avec 7 ajouts et 5 suppressions
  1. +7
    -5
      pay/pay_by_join.go

+ 7
- 5
pay/pay_by_join.go Voir le fichier

@@ -10,10 +10,11 @@ import (
"strings"
)

func UniPayByJoin(payParams *md.JoinPayReq, paySecretKey string,isPrd bool) (*md.JoinPayResponse, error) {
func UniPayByJoin(payParams *md.JoinPayReq, paySecretKey string, isPrd bool) (*md.JoinPayResponse, error) {
payParams.P0Version = "2.1"
//payParams.P1MerchantNo = md.PayTestAccount
payParams.P4Cur = "1"
//可注释行:
//payParams.P1MerchantNo = md.PayTestAccount
//payParams.P2OrderNo = "95271"
//payParams.P3Amount = "0.1"
//payParams.P5ProductName = "测试商品"
@@ -29,13 +30,14 @@ func UniPayByJoin(payParams *md.JoinPayReq, paySecretKey string,isPrd bool) (*md
//payParams.QATradeMerchantNo = md.PayTestAliAccount
//商家报备编号(分微信和支付宝的);微信的:
//payParams.QATradeMerchantNo = md.PayTestWeChatAccount
//不可注释行:
postData := url.Values{}
creatHmac(payParams,paySecretKey, &postData)
creatHmac(payParams, paySecretKey, &postData)
zhios_pay_utils.FilePutContents("UniPayByJoin", zhios_pay_utils.SerializeStr(map[string]interface{}{
"data": payParams,
}))
tr := &http.Transport{
TLSClientConfig: &tls.Config{InsecureSkipVerify: true},
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()))
@@ -49,7 +51,7 @@ func UniPayByJoin(payParams *md.JoinPayReq, paySecretKey string,isPrd bool) (*md
return &resp, err
}

func creatHmac(payParams *md.JoinPayReq,paySecretKey string, postData *url.Values) {
func creatHmac(payParams *md.JoinPayReq, paySecretKey string, postData *url.Values) {
hmac := ""
if payParams.P0Version != "" {
postData.Add("p0_Version", payParams.P0Version)


Chargement…
Annuler
Enregistrer