소스 검색

汇聚支付-聚合支付

tags/v1.3.8
jiaoboxiang 2 년 전
부모
커밋
6e5c9f1505
1개의 변경된 파일7개의 추가작업 그리고 5개의 파일을 삭제
  1. +7
    -5
      pay/pay_by_join.go

+ 7
- 5
pay/pay_by_join.go 파일 보기

@@ -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)


불러오는 중...
취소
저장