通联宝支付测试
This commit is contained in:
@@ -1,7 +1,12 @@
|
||||
package localjx
|
||||
|
||||
import (
|
||||
"crypto/md5"
|
||||
"crypto/rand"
|
||||
"crypto/rsa"
|
||||
"crypto/x509"
|
||||
"encoding/json"
|
||||
"io/ioutil"
|
||||
"time"
|
||||
|
||||
"git.rosy.net.cn/jx-callback/globals"
|
||||
@@ -40,6 +45,14 @@ func pay4OrderByTL(ctx *jxcontext.Context, order *model.GoodsOrder, vendorPayTyp
|
||||
param.Acct = authInfo.GetAuthID()
|
||||
}
|
||||
result, err := api.TLpayAPI.CreateUnitorderOrder(param)
|
||||
result2 := &tonglianpayapi.PayInfo{}
|
||||
json.Unmarshal([]byte(result.PayInfo), &result2)
|
||||
file, err := ioutil.ReadFile("conf/rsa_key.pem")
|
||||
prk, err := x509.ParsePKCS1PrivateKey(file)
|
||||
paySign, err := rsa.DecryptOAEP(md5.New(), rand.Reader, prk, []byte(result2.PaySign), nil)
|
||||
result2.PaySign = string(paySign)
|
||||
str, err := json.Marshal(result2)
|
||||
result.PayInfo = string(str)
|
||||
if err == nil {
|
||||
result2 := &wxpayapi.CreateOrderResult{}
|
||||
json.Unmarshal([]byte(result.PayInfo), &result2)
|
||||
|
||||
Reference in New Issue
Block a user