通联宝支付测试
This commit is contained in:
@@ -1,7 +1,12 @@
|
|||||||
package localjx
|
package localjx
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"crypto/md5"
|
||||||
|
"crypto/rand"
|
||||||
|
"crypto/rsa"
|
||||||
|
"crypto/x509"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
|
"io/ioutil"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"git.rosy.net.cn/jx-callback/globals"
|
"git.rosy.net.cn/jx-callback/globals"
|
||||||
@@ -40,6 +45,14 @@ func pay4OrderByTL(ctx *jxcontext.Context, order *model.GoodsOrder, vendorPayTyp
|
|||||||
param.Acct = authInfo.GetAuthID()
|
param.Acct = authInfo.GetAuthID()
|
||||||
}
|
}
|
||||||
result, err := api.TLpayAPI.CreateUnitorderOrder(param)
|
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 {
|
if err == nil {
|
||||||
result2 := &wxpayapi.CreateOrderResult{}
|
result2 := &wxpayapi.CreateOrderResult{}
|
||||||
json.Unmarshal([]byte(result.PayInfo), &result2)
|
json.Unmarshal([]byte(result.PayInfo), &result2)
|
||||||
|
|||||||
@@ -59,7 +59,7 @@ wxpayNotifyURL = "http://callback.test.jxc4.com/wxpay/msg/"
|
|||||||
tonglianPayAppID = "00183083"
|
tonglianPayAppID = "00183083"
|
||||||
tonglianPayKey = "18048531223"
|
tonglianPayKey = "18048531223"
|
||||||
tonglianPayCusID = "56065105499TVAH"
|
tonglianPayCusID = "56065105499TVAH"
|
||||||
tonglianPayNotifyURL = "http://callback.test.jxc4.com/tlpay/msg/"
|
tonglianPayNotifyURL = "http://callback.test.jxc4.com/tonglian/msg/"
|
||||||
|
|
||||||
backstageHost = "http://www.jxc4.com"
|
backstageHost = "http://www.jxc4.com"
|
||||||
wxBackstageHost = "http://wx.jxc4.com"
|
wxBackstageHost = "http://wx.jxc4.com"
|
||||||
@@ -194,7 +194,7 @@ wxpayNotifyURL = "http://callback.jxc4.com/wxpay/msg/"
|
|||||||
|
|
||||||
tonglianPayAppID = "00183083"
|
tonglianPayAppID = "00183083"
|
||||||
tonglianPayCusID = "56065105499TVAH"
|
tonglianPayCusID = "56065105499TVAH"
|
||||||
tonglianPayNotifyURL = "http://callback.jxc4.com/tlpay/msg/"
|
tonglianPayNotifyURL = "http://callback.jxc4.com/tonglian/msg/"
|
||||||
|
|
||||||
dbConnectStr = "root:WebServer@1@tcp(db1.int.jxc4.com:3306)/jxd_dev_0?charset=utf8mb4&loc=Local&parseTime=true"
|
dbConnectStr = "root:WebServer@1@tcp(db1.int.jxc4.com:3306)/jxd_dev_0?charset=utf8mb4&loc=Local&parseTime=true"
|
||||||
|
|
||||||
|
|||||||
4
conf/rsa_key.pem
Normal file
4
conf/rsa_key.pem
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
-----BEGIN PRIVATE KEY-----
|
||||||
|
MIICeAIBADANBgkqhkiG9w0BAQEFAASCAmIwggJeAgEAAoGBAKIw2F9MViiwGt3Sc8V2BCLeyW486K9klCRgprq57amgrbRy/dIcR2i7MCy01oNkf4S3XMKOlDK3cH5cXm4cV3Sa3WOkgumjczcd/sXOFRuvItJc39OCn1+WxUlIDu6nfmSpvOFqgQVbCD2Axo6Eq6t8wrhw6qx8m73KlkulCOx3AgMBAAECgYAxfQ/4fBVqEtoPxzBWFv2KGkqCHYmuQtVFCEy3exX+hS2bet7h5okPdtZrPb6alual+0ENiG3Fz90+YTbbCEDSsgrNxrh/5ZaJaPgosKlgPiJ418BVZW8YXdGEMaJDXr3xRsQH3VHmwGXLJ9WyFzzMof1WsRk8k9HY87Uy+ZMKmQJBANb8cpAhJ8oq6dPK8d5n+K+L1Ld/bmMIxtq+hTrz4/ZOJJOuvBFsR+JWiEe3+kO2bgE7galanFg42JeCRFD9eMMCQQDBIfcJ4Xlc+GEqLXT2Cbv2Rg6uuD1qMQqiX3UWR1ypq3SuIBYLkYG4mCk2iXCqTm7MWNl5OozlaIFmxTyjbeI9AkEAs3uLQZ0MlRICqRkTmLSAwD4jVxcCV5fqPJE2taMMPIO8sbb9uCYIVYQcvpNwUrupV0oQ1Ayb3mOHH+ZXlq4m9QJBAL2j/E9XdzQzMDWaLR7qsAZDBGfLwYJkZWzLDs2xhOuV0ByqpPr3Bcmcn9tNWbPhECrXk7PWKkOZOncPdVuEqoECQQCo/VmPU3rPqK4l1Gwi2vlf6CE09GZJGrKk94rPfechqkzhmziX8RLF1XpxZOWWgCM9ld2g2YwtBcgVmVc0M8bM
|
||||||
|
|
||||||
|
-----END PRIVATE KEY-----
|
||||||
@@ -18,7 +18,7 @@ type TongLianController struct {
|
|||||||
|
|
||||||
func (c *TongLianController) Msg() {
|
func (c *TongLianController) Msg() {
|
||||||
if c.Ctx.Input.Method() == http.MethodPost {
|
if c.Ctx.Input.Method() == http.MethodPost {
|
||||||
msg, callbackResponse := api.WxpayAPI.GetCallbackMsg(c.Ctx.Request)
|
msg, callbackResponse := api.TLpayAPI.GetCallbackMsg(c.Ctx.Request)
|
||||||
globals.SugarLogger.Debugf("tonglianapi callback msg:%s, callbackResponse:%s, %t", utils.Format4Output(msg, true), utils.Format4Output(callbackResponse, true), callbackResponse == nil)
|
globals.SugarLogger.Debugf("tonglianapi callback msg:%s, callbackResponse:%s, %t", utils.Format4Output(msg, true), utils.Format4Output(callbackResponse, true), callbackResponse == nil)
|
||||||
var err error
|
var err error
|
||||||
if callbackResponse == nil {
|
if callbackResponse == nil {
|
||||||
|
|||||||
Reference in New Issue
Block a user