通联宝支付测试

This commit is contained in:
苏尹岚
2020-02-27 09:23:22 +08:00
parent fbbfbce622
commit 71bccc687b

View File

@@ -48,8 +48,17 @@ func pay4OrderByTL(ctx *jxcontext.Context, order *model.GoodsOrder, vendorPayTyp
result2 := &tonglianpayapi.PayInfo{}
json.Unmarshal([]byte(result.PayInfo), &result2)
file, err := ioutil.ReadFile("conf/rsa_key.pem")
prk, err := x509.ParsePKCS8PrivateKey(file)
if err != nil {
return nil, err
}
prk, err := x509.ParsePKCS1PrivateKey(file)
if err != nil {
return nil, err
}
paySign, err := rsa.DecryptOAEP(md5.New(), rand.Reader, prk, []byte(result2.PaySign), nil)
if err != nil {
return nil, err
}
result2.PaySign = string(paySign)
str, err := json.Marshal(result2)
result.PayInfo = string(str)