package com.ruoyi.web.core.config;

import com.ruoyi.mall.util.PayConstants;
import com.wechat.pay.java.core.Config;
import com.wechat.pay.java.core.RSAAutoCertificateConfig;

public class WechatPayConfig {

    private static Config wechatPayConfig;

    private WechatPayConfig(){}

    public static Config getInstance() {


        if (wechatPayConfig == null) {
            wechatPayConfig = new RSAAutoCertificateConfig.Builder()
                    .merchantId(PayConstants.MCH_ID)
                    .privateKeyFromPath(PayConstants.PRIVATE_KEY_FILE_PATH)
                    .merchantSerialNumber(PayConstants.MCH_SERIAL_NO)
                    .apiV3Key(PayConstants.API_V3KEY)
                    .build();
        }
        return wechatPayConfig;
    }
}
