package com.sinata.config.properties;
|
|
import cn.hutool.core.util.StrUtil;
|
import com.sinata.core.util.ToolUtil;
|
import lombok.Data;
|
import org.springframework.boot.context.properties.ConfigurationProperties;
|
import org.springframework.stereotype.Component;
|
|
/**
|
* 支付宝配置
|
*
|
* @author frankevil
|
* @date 2023/3/3 23:45
|
**/
|
@Data
|
@Component
|
@ConfigurationProperties(prefix = AliPayProperties.ALI_PLAY_PREFIX)
|
public class AliPayProperties {
|
protected static final String ALI_PLAY_PREFIX = "alipay";
|
|
/**
|
* 应用编号
|
*/
|
private String appId;
|
/**
|
* 应用私钥
|
*/
|
private String privateKey;
|
/**
|
* 支付宝公钥,通过应用公钥上传到支付宝开放平台换取支付宝公钥(如果是证书模式,公钥与私钥在CSR目录)。
|
*/
|
private String publicKey;
|
/**
|
* 应用公钥证书 (证书模式必须)
|
*/
|
private String appCertPath;
|
/**
|
* 支付宝公钥证书 (证书模式必须)
|
*/
|
private String aliPayCertPath;
|
/**
|
* 支付宝根证书 (证书模式必须)
|
*/
|
private String aliPayRootCertPath;
|
/**
|
* 支付宝支付网关
|
*/
|
private String serverUrl;
|
/**
|
* 外网访问项目的域名,支付通知中会使用
|
*/
|
private String domain;
|
|
|
public String getAppCertPath() {
|
if (StrUtil.isNotBlank(appCertPath)) {
|
return ToolUtil.getJarPath() + appCertPath;
|
}
|
return "";
|
}
|
|
public String getAliPayCertPath() {
|
if (StrUtil.isNotBlank(aliPayCertPath)) {
|
return ToolUtil.getJarPath() + aliPayCertPath;
|
}
|
return "";
|
}
|
|
public String getAliPayRootCertPath() {
|
if (StrUtil.isNotBlank(aliPayRootCertPath)) {
|
return ToolUtil.getJarPath() + aliPayRootCertPath;
|
}
|
return "";
|
}
|
}
|