证书方式

This commit is contained in:
richboo111
2022-08-17 10:15:33 +08:00
parent 68b6a7c745
commit b65467d236
2 changed files with 9 additions and 9 deletions

View File

@@ -14,8 +14,8 @@ import (
const (
AliPayPublicCertPath = "./config/alipayCertPublicKey_RSA2.crt" // 支付宝公钥证书文件路径
aliPayRootCertPath = "./config/alipayRootCert.crt" // 支付宝根证书文件路径
appCertPath = "./config/appCertPublicKey_2019110769024042.crt" // 应用公钥证书路径
AliPayRootCertPath = "./config/alipayRootCert.crt" // 支付宝根证书文件路径
AppCertPath = "./config/appCertPublicKey_2019110769024042.crt" // 应用公钥证书路径
MinWithdrawalMoney = 50 // 最小提现金额,不用审核
)
@@ -71,7 +71,7 @@ func (a *API) Withdrawal4AliPay(param *WithdrawalParam) (*Withdrawal4AliPayRes,
param.PayeeInfo.IdentityType = "ALIPAY_LOGON_ID"
// 获取证书
appCertSN, aliPayRootCertSN, aliPayPublicCertSN, err := SetCertSnByPath(appCertPath, aliPayRootCertPath, AliPayPublicCertPath)
appCertSN, aliPayRootCertSN, aliPayPublicCertSN, err := SetCertSnByPath(AppCertPath, AliPayRootCertPath, AliPayPublicCertPath)
if err != nil {
return nil, err
}
@@ -94,15 +94,15 @@ func (a *API) Withdrawal4AliPay(param *WithdrawalParam) (*Withdrawal4AliPayRes,
}
// SetCertSnByPath 通过应用公钥证书路径设置 app_cert_sn、alipay_root_cert_sn、alipay_cert_sn
// appCertPath应用公钥证书路径
// aliPayRootCertPath支付宝根证书文件路径
// AppCertPath应用公钥证书路径
// AliPayRootCertPath支付宝根证书文件路径
// aliPayPublicCertPath支付宝公钥证书文件路径
func SetCertSnByPath(appCertPath, aliPayRootCertPath, aliPayPublicCertPath string) (string, string, string, error) {
appCertSn, err := GetCertSN(appCertPath)
func SetCertSnByPath(AppCertPath, AliPayRootCertPath, aliPayPublicCertPath string) (string, string, string, error) {
appCertSn, err := GetCertSN(AppCertPath)
if err != nil {
return "", "", "", fmt.Errorf("get app_cert_sn return err, but alse return alipay client. err: %w", err)
}
rootCertSn, err := GetRootCertSN(aliPayRootCertPath)
rootCertSn, err := GetRootCertSN(AliPayRootCertPath)
if err != nil {
return "", "", "", fmt.Errorf("get alipay_root_cert_sn return err, but alse return alipay client. err: %w", err)
}

View File

@@ -44,7 +44,7 @@ func (a *API) SystemAuthToken(grantType, code, refreshToken string) (tokenInfo *
params["refresh_token"] = refreshToken
}
// 获取证书
appCertSN, aliPayRootCertSN, aliPayPublicCertSN, err := SetCertSnByPath(appCertPath, aliPayRootCertPath, AliPayPublicCertPath)
appCertSN, aliPayRootCertSN, aliPayPublicCertSN, err := SetCertSnByPath(AppCertPath, AliPayRootCertPath, AliPayPublicCertPath)
if err != nil {
return nil, err
}