mitao
2024-07-08 022a7ff7abf82cd2546e18071ade5228b4e2339f
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
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:43
 **/
@Data
@Component
@ConfigurationProperties(prefix = WxPayProperties.WX_PLAY_PREFIX)
public class WxPayProperties {
    protected static final String WX_PLAY_PREFIX = "wxpay";
 
    /**
     * 是否使用沙盒 默认不使用
     */
    private boolean sandboxnew;
 
    /**
     * 应用编号
     */
    private String appId;
 
    /**
     * appSecret 是 appId 对应的接口密码,微信公众号授权获取用户 openId 时使用
     */
    private String appSecret;
    /**
     * 微信支付商户号
     */
    private String mchId;
 
    /**
     * API 密钥,微信商户后台配置
     */
    private String partnerKey;
    /**
     * apiclient_cert.p1 证书路径,在微信商户后台下载
     */
    private String certPath;
 
    /**
     * 外网访问项目的域名,支付通知中会使用
     */
    private String domain;
 
 
    public String getCertPath() {
        if (StrUtil.isNotBlank(certPath)) {
            return ToolUtil.getJarPath() + certPath;
        }
        return "";
    }
}