package org.jeecg.modules.pay.serverPay;
 
import lombok.extern.slf4j.Slf4j;
import org.jeecg.common.exception.JeecgBootException;
import org.springframework.stereotype.Component;

@Slf4j
@Component
public class WxV3PayConfig {
    // 服务商AppId
    private String appIdValue = "wx43b5b906cc30ed0b";
    public static String APP_ID= "wx43b5b906cc30ed0b";
 
    // 服务商商户号
    private String mchIdValue= "1649629687";
    public static String Mch_ID= "1649629687";
 
    // 平台收款商户号
    public static String smidVx= "";
    private  String smidVxValue= "";
 
    // 服务商商户私钥
    private String apiV3KeyValue= "4b64e17419689527b256f07cdf6bd60c";
    public static String apiV3Key= "4b64e17419689527b256f07cdf6bd60c";

    // 证书序列号
    private String mchSerialNoValue= "5EB65CC0F912EA2ADD3363EA3DA0230DF6DA90BC";
    public static String mchSerialNo= "5EB65CC0F912EA2ADD3363EA3DA0230DF6DA90BC";
 
    private String privateKeyPathValue= "/certTest/apiclient_key.pem";
    public static String privateKeyPath= "/certTest/apiclient_key.pem";
 
    // 如果需要静态访问，可以使用 @PostConstruct 初始化静态变量
//    @PostConstruct
    public void init() {
        APP_ID = this.appIdValue;
        APP_ID = this.appIdValue;
        smidVx = this.smidVxValue;
        apiV3Key = this.apiV3KeyValue;
        mchSerialNo = this.mchSerialNoValue;
        privateKeyPath = this.privateKeyPathValue; // WXPaySignatureCertificateUtil 会用到这个路径
 
 
        // 可以在这里加一些非空检查
        if (APP_ID == null || Mch_ID == null || apiV3Key == null || mchSerialNo == null || privateKeyPath == null) {
             throw new JeecgBootException("微信支付V3配置加载不完整，请检查配置文件！");
        } else {
             log.info("微信支付V3配置加载完成。");
        }
    }
 
 
}