支付宝证书

This commit is contained in:
陈俊宏 2024-08-06 16:55:18 +08:00
parent 2927161585
commit 38f3e04352
5 changed files with 15 additions and 15 deletions

View File

@ -66,9 +66,9 @@ func closeOrder() {
req.Ali = paymentService.AliPay{
AppId: orderInfo.AppId,
PrivateKey: ali.PrivateKey,
AppPublicCert: []byte(ali.AppPublicCert),
AlipayRootCert: []byte(ali.AlipayRootCert),
AlipayPublicCert: []byte(ali.AlipayPublicCert),
AppPublicCert: ali.AppPublicCert,
AlipayRootCert: ali.AlipayRootCert,
AlipayPublicCert: ali.AlipayPublicCert,
}
default:
utils.Log(nil, "关闭订单,支付渠道不支持", orderInfo.ChannelType)
@ -148,9 +148,9 @@ func queryOrder() {
query.Ali = paymentService.AliPay{
AppId: orderInfo.AppId,
PrivateKey: ali.PrivateKey,
AppPublicCert: []byte(ali.AppPublicCert),
AlipayRootCert: []byte(ali.AlipayRootCert),
AlipayPublicCert: []byte(ali.AlipayPublicCert),
AppPublicCert: ali.AppPublicCert,
AlipayRootCert: ali.AlipayRootCert,
AlipayPublicCert: ali.AlipayPublicCert,
}
default:
utils.Log(nil, "查询订单,支付渠道不支持", orderInfo.ChannelType)

View File

@ -124,9 +124,9 @@ func AliCallback(c *gin.Context) {
}
aliConfig.AppId = payChannelModel.AppId
aliConfig.PrivateKey = aliConfigModel.PrivateKey
aliConfig.AppPublicCert = []byte(aliConfigModel.AppPublicCert)
aliConfig.AlipayRootCert = []byte(aliConfigModel.AlipayRootCert)
aliConfig.AlipayPublicCert = []byte(aliConfigModel.AlipayPublicCert)
aliConfig.AppPublicCert = aliConfigModel.AppPublicCert
aliConfig.AlipayRootCert = aliConfigModel.AlipayRootCert
aliConfig.AlipayPublicCert = aliConfigModel.AlipayPublicCert
notifyReq, err := alipay.ParseNotifyToBodyMap(c.Request) // c.Request 是 gin 框架的写法
if err != nil {

View File

@ -138,7 +138,7 @@ func (o *OrderThirdLogResponse) ResponseFromDb(db orderthirdpaylogmodel.OrderThi
o.OrderId = db.OrderId
o.PayCallback = db.PayCallback
o.Status = db.Status
o.MerchantParam = db.MerchantParam
o.MerchantParam = db.PayParam
o.MerchantCallback = db.MerchantCallback
o.CreateTime = db.CreateTime.Format("2006-01-02 15:04:05")
}

View File

@ -43,10 +43,10 @@ func AliInitClient(aliConfig AliPay) {
// 自动同步验签(只支持证书模式)
// 传入 alipayPublicCert.crt 内容
aliClient.AutoVerifySign(aliConfig.AlipayPublicCert)
aliClient.AutoVerifySign([]byte(aliConfig.AlipayPublicCert))
// 证书内容
aliClientErr = aliClient.SetCertSnByContent(aliConfig.AppPublicCert, aliConfig.AlipayRootCert, aliConfig.AlipayPublicCert)
aliClientErr = aliClient.SetCertSnByContent([]byte(aliConfig.AppPublicCert), []byte(aliConfig.AlipayRootCert), []byte(aliConfig.AlipayPublicCert))
}
// GetAliClient 获取已经初始化的支付宝客户端

View File

@ -34,9 +34,9 @@ type WxPay struct {
type AliPay struct {
AppId string `json:"app_id"` // 应用ID
PrivateKey string `json:"private_key"` // 应用私钥
AppPublicCert []byte `json:"app_public_cert"` // 应用公钥
AlipayRootCert []byte `json:"alipay_root_cert"` // 支付宝根证书
AlipayPublicCert []byte `json:"alipay_public_cert"` // 支付宝公钥
AppPublicCert string `json:"app_public_cert"` // 应用公钥
AlipayRootCert string `json:"alipay_root_cert"` // 支付宝根证书
AlipayPublicCert string `json:"alipay_public_cert"` // 支付宝公钥
}
type PayOrderResponse struct {