证书方式
This commit is contained in:
@@ -14,8 +14,8 @@ import (
|
|||||||
|
|
||||||
const (
|
const (
|
||||||
AliPayPublicCertPath = "./config/alipayCertPublicKey_RSA2.crt" // 支付宝公钥证书文件路径
|
AliPayPublicCertPath = "./config/alipayCertPublicKey_RSA2.crt" // 支付宝公钥证书文件路径
|
||||||
aliPayRootCertPath = "./config/alipayRootCert.crt" // 支付宝根证书文件路径
|
AliPayRootCertPath = "./config/alipayRootCert.crt" // 支付宝根证书文件路径
|
||||||
appCertPath = "./config/appCertPublicKey_2019110769024042.crt" // 应用公钥证书路径
|
AppCertPath = "./config/appCertPublicKey_2019110769024042.crt" // 应用公钥证书路径
|
||||||
MinWithdrawalMoney = 50 // 最小提现金额,不用审核
|
MinWithdrawalMoney = 50 // 最小提现金额,不用审核
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -71,7 +71,7 @@ func (a *API) Withdrawal4AliPay(param *WithdrawalParam) (*Withdrawal4AliPayRes,
|
|||||||
param.PayeeInfo.IdentityType = "ALIPAY_LOGON_ID"
|
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 {
|
if err != nil {
|
||||||
return nil, err
|
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
|
// SetCertSnByPath 通过应用公钥证书路径设置 app_cert_sn、alipay_root_cert_sn、alipay_cert_sn
|
||||||
// appCertPath:应用公钥证书路径
|
// AppCertPath:应用公钥证书路径
|
||||||
// aliPayRootCertPath:支付宝根证书文件路径
|
// AliPayRootCertPath:支付宝根证书文件路径
|
||||||
// aliPayPublicCertPath:支付宝公钥证书文件路径
|
// aliPayPublicCertPath:支付宝公钥证书文件路径
|
||||||
func SetCertSnByPath(appCertPath, aliPayRootCertPath, aliPayPublicCertPath string) (string, string, string, error) {
|
func SetCertSnByPath(AppCertPath, AliPayRootCertPath, aliPayPublicCertPath string) (string, string, string, error) {
|
||||||
appCertSn, err := GetCertSN(appCertPath)
|
appCertSn, err := GetCertSN(AppCertPath)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return "", "", "", fmt.Errorf("get app_cert_sn return err, but alse return alipay client. err: %w", err)
|
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 {
|
if err != nil {
|
||||||
return "", "", "", fmt.Errorf("get alipay_root_cert_sn return err, but alse return alipay client. err: %w", err)
|
return "", "", "", fmt.Errorf("get alipay_root_cert_sn return err, but alse return alipay client. err: %w", err)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ func (a *API) SystemAuthToken(grantType, code, refreshToken string) (tokenInfo *
|
|||||||
params["refresh_token"] = refreshToken
|
params["refresh_token"] = refreshToken
|
||||||
}
|
}
|
||||||
// 获取证书
|
// 获取证书
|
||||||
appCertSN, aliPayRootCertSN, aliPayPublicCertSN, err := SetCertSnByPath(appCertPath, aliPayRootCertPath, AliPayPublicCertPath)
|
appCertSN, aliPayRootCertSN, aliPayPublicCertSN, err := SetCertSnByPath(AppCertPath, AliPayRootCertPath, AliPayPublicCertPath)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user