Java Code Examples for com.github.binarywang.wxpay.config.WxPayConfig#setAppId()

The following examples show how to use com.github.binarywang.wxpay.config.WxPayConfig#setAppId() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: WxPayConfiguration.java    From mall4j with GNU Affero General Public License v3.0 6 votes vote down vote up
private WxPayService getWxMpPayServiceByAppId(String appid) {
        WxPayConfig payConfig = new WxPayConfig();
        payConfig.setAppId(appid);
        payConfig.setMchId(wxPay.getMchId());
        payConfig.setMchKey(wxPay.getMchKey());
        payConfig.setKeyPath(wxPay.getKeyPath());
        payConfig.setSignType(WxPayConstants.SignType.MD5);

        WxPayService wxPayService = new WxPayServiceImpl();

//      打开下面的代码,开启沙箱模式
//        if (Objects.equals(profile, "dev")) {
//            String sandboxSignKey = null;
//            try {
//                wxPayService.setConfig(payConfig);
//                sandboxSignKey = wxPayService.getSandboxSignKey();
//            } catch (WxPayException e) {
//                e.printStackTrace();
//            }
//            payConfig.setUseSandboxEnv(true);
//            payConfig.setMchKey(sandboxSignKey);
//        }

        wxPayService.setConfig(payConfig);
        return wxPayService;
    }
 
Example 2
Source File: WxMaConfiguration.java    From charging_pile_cloud with MIT License 6 votes vote down vote up
@Bean
@ConditionalOnMissingBean
public WxPayService wxService() {
    WxPayConfig payConfig = new WxPayConfig();
    payConfig.setAppId(StringUtils.trimToNull(wxPayProperties.getAppId()));
    payConfig.setMchId(StringUtils.trimToNull(wxPayProperties.getMchId()));
    payConfig.setMchKey(StringUtils.trimToNull(wxPayProperties.getMchKey()));
    payConfig.setSignType("MD5");
    payConfig.setNotifyUrl(StringUtils.trimToNull(wxPayProperties.getNotifyUrl()));
   // payConfig.setKeyPath(StringUtils.trimToNull(wxPayProperties.getKeyPath()));

    // 可以指定是否使用沙箱环境
    payConfig.setUseSandboxEnv(false);

    WxPayService wxPayService = new WxPayServiceImpl();
    wxPayService.setConfig(payConfig);
    return wxPayService;
}
 
Example 3
Source File: WxPayUtil.java    From fw-cloud-framework with MIT License 6 votes vote down vote up
/**
 * 获取微信支付配置
 */
public static WxPayConfig getWxPayConfig(String configParam, String tradeType,
		String certRootPath, String notifyUrl) {
	WxPayConfig wxPayConfig = new WxPayConfig();
	JSONObject paramObj = JSON.parseObject(configParam);
	wxPayConfig.setMchId(paramObj.getString("mchId"));
	if (null != tradeType && tradeType.equals(PayConstant.WxConstant.TRADE_TYPE_APP)) {
		wxPayConfig.setAppId(paramObj.getString("openAppId"));
	} else {
		wxPayConfig.setAppId(paramObj.getString("appId"));
	}
	wxPayConfig.setMchKey(paramObj.getString("key"));
	if (!PublicHelper.isEmpty(certRootPath)) wxPayConfig.setKeyPath(certRootPath + File.separator + paramObj.getString("certLocalPath"));
	if (!PublicHelper.isEmpty(notifyUrl)) wxPayConfig.setNotifyUrl(notifyUrl);
	if (!PublicHelper.isEmpty(tradeType)) wxPayConfig.setTradeType(tradeType);
	return wxPayConfig;
}
 
Example 4
Source File: WxConfig.java    From BigDataPlatform with GNU General Public License v3.0 5 votes vote down vote up
@Bean
public WxPayConfig wxPayConfig() {
    WxPayConfig payConfig = new WxPayConfig();
    payConfig.setAppId(properties.getAppId());
    payConfig.setMchId(properties.getMchId());
    payConfig.setMchKey(properties.getMchKey());
    payConfig.setNotifyUrl(properties.getNotifyUrl());
    payConfig.setKeyPath(properties.getKeyPath());
    payConfig.setTradeType("JSAPI");
    payConfig.setSignType("MD5");
    return payConfig;
}
 
Example 5
Source File: WxConfig.java    From dts-shop with GNU Lesser General Public License v3.0 5 votes vote down vote up
@Bean
public WxPayConfig wxPayConfig() {
	WxPayConfig payConfig = new WxPayConfig();
	payConfig.setAppId(properties.getAppId());
	payConfig.setMchId(properties.getMchId());
	payConfig.setMchKey(properties.getMchKey());
	payConfig.setNotifyUrl(properties.getNotifyUrl());
	payConfig.setKeyPath(properties.getKeyPath());
	payConfig.setTradeType("JSAPI");
	payConfig.setSignType("MD5");
	return payConfig;
}
 
Example 6
Source File: WxConfig.java    From mall with MIT License 5 votes vote down vote up
@Bean
public WxPayConfig wxPayConfig() {
    WxPayConfig payConfig = new WxPayConfig();
    payConfig.setAppId(properties.getAppId());
    payConfig.setMchId(properties.getMchId());
    payConfig.setMchKey(properties.getMchKey());
    payConfig.setNotifyUrl(properties.getNotifyUrl());
    payConfig.setKeyPath(properties.getKeyPath());
    payConfig.setTradeType("JSAPI");
    payConfig.setSignType("MD5");
    return payConfig;
}
 
Example 7
Source File: WxConfig.java    From litemall with MIT License 5 votes vote down vote up
@Bean
public WxPayConfig wxPayConfig() {
    WxPayConfig payConfig = new WxPayConfig();
    payConfig.setAppId(properties.getAppId());
    payConfig.setMchId(properties.getMchId());
    payConfig.setMchKey(properties.getMchKey());
    payConfig.setNotifyUrl(properties.getNotifyUrl());
    payConfig.setKeyPath(properties.getKeyPath());
    payConfig.setTradeType("JSAPI");
    payConfig.setSignType("MD5");
    return payConfig;
}
 
Example 8
Source File: WxPayConfiguration.java    From springboot-seed with MIT License 5 votes vote down vote up
@Bean
@ConditionalOnMissingBean
public WxPayService wxService() {
    WxPayConfig payConfig = new WxPayConfig();
    payConfig.setAppId(StringUtils.trimToNull(this.properties.getAppId()));
    payConfig.setMchId(StringUtils.trimToNull(this.properties.getMchId()));
    payConfig.setMchKey(StringUtils.trimToNull(this.properties.getMchKey()));
    payConfig.setSubAppId(StringUtils.trimToNull(this.properties.getSubAppId()));
    payConfig.setSubMchId(StringUtils.trimToNull(this.properties.getSubMchId()));
    payConfig.setKeyPath(StringUtils.trimToNull(this.properties.getKeyPath()));

    WxPayService wxPayService = new WxPayServiceImpl();
    wxPayService.setConfig(payConfig);
    return wxPayService;
}
 
Example 9
Source File: WxPayUtil.java    From xxpay-master with MIT License 5 votes vote down vote up
/**
 * 获取微信支付配置
 * @param configParam
 * @param tradeType
 * @param certRootPath
 * @param notifyUrl
 * @return
 */
public static WxPayConfig getWxPayConfig(String configParam, String tradeType, String certRootPath, String notifyUrl) {
    WxPayConfig wxPayConfig = new WxPayConfig();
    JSONObject paramObj = JSON.parseObject(configParam);
    wxPayConfig.setMchId(paramObj.getString("mchId"));
    wxPayConfig.setAppId(paramObj.getString("appId"));
    wxPayConfig.setKeyPath(certRootPath + File.separator + paramObj.getString("certLocalPath"));
    wxPayConfig.setMchKey(paramObj.getString("key"));
    wxPayConfig.setNotifyUrl(notifyUrl);
    wxPayConfig.setTradeType(tradeType);
    return wxPayConfig;
}
 
Example 10
Source File: WxPayUtil.java    From xxpay-master with MIT License 5 votes vote down vote up
/**
 * 获取微信支付配置
 * @param configParam
 * @return
 */
public static WxPayConfig getWxPayConfig(String configParam) {
    WxPayConfig wxPayConfig = new WxPayConfig();
    JSONObject paramObj = JSON.parseObject(configParam);
    wxPayConfig.setMchId(paramObj.getString("mchId"));
    wxPayConfig.setAppId(paramObj.getString("appId"));
    wxPayConfig.setMchKey(paramObj.getString("key"));
    return wxPayConfig;
}
 
Example 11
Source File: WxPayUtil.java    From xxpay-master with MIT License 5 votes vote down vote up
/**
 * 获取微信支付配置
 * @param configParam
 * @param tradeType
 * @param certRootPath
 * @param notifyUrl
 * @return
 */
public static WxPayConfig getWxPayConfig(String configParam, String tradeType, String certRootPath, String notifyUrl) {
    WxPayConfig wxPayConfig = new WxPayConfig();
    JSONObject paramObj = JSON.parseObject(configParam);
    wxPayConfig.setMchId(paramObj.getString("mchId"));
    wxPayConfig.setAppId(paramObj.getString("appId"));
    wxPayConfig.setKeyPath(certRootPath + File.separator + paramObj.getString("certLocalPath"));
    wxPayConfig.setMchKey(paramObj.getString("key"));
    wxPayConfig.setNotifyUrl(notifyUrl);
    wxPayConfig.setTradeType(tradeType);
    return wxPayConfig;
}
 
Example 12
Source File: WxPayUtil.java    From xxpay-master with MIT License 5 votes vote down vote up
/**
 * 获取微信支付配置
 * @param configParam
 * @return
 */
public static WxPayConfig getWxPayConfig(String configParam) {
    WxPayConfig wxPayConfig = new WxPayConfig();
    JSONObject paramObj = JSON.parseObject(configParam);
    wxPayConfig.setMchId(paramObj.getString("mchId"));
    wxPayConfig.setAppId(paramObj.getString("appId"));
    wxPayConfig.setMchKey(paramObj.getString("key"));
    return wxPayConfig;
}
 
Example 13
Source File: WxPayUtil.java    From xxpay-master with MIT License 5 votes vote down vote up
/**
 * 获取微信支付配置
 * @param configParam
 * @param tradeType
 * @param certRootPath
 * @param notifyUrl
 * @return
 */
public static WxPayConfig getWxPayConfig(String configParam, String tradeType, String certRootPath, String notifyUrl) {
    WxPayConfig wxPayConfig = new WxPayConfig();
    JSONObject paramObj = JSON.parseObject(configParam);
    wxPayConfig.setMchId(paramObj.getString("mchId"));
    wxPayConfig.setAppId(paramObj.getString("appId"));
    wxPayConfig.setKeyPath(certRootPath + File.separator + paramObj.getString("certLocalPath"));
    wxPayConfig.setMchKey(paramObj.getString("key"));
    wxPayConfig.setNotifyUrl(notifyUrl);
    wxPayConfig.setTradeType(tradeType);
    return wxPayConfig;
}
 
Example 14
Source File: WxPayUtil.java    From xxpay-master with MIT License 5 votes vote down vote up
/**
 * 获取微信支付配置
 * @param configParam
 * @return
 */
public static WxPayConfig getWxPayConfig(String configParam) {
    WxPayConfig wxPayConfig = new WxPayConfig();
    JSONObject paramObj = JSON.parseObject(configParam);
    wxPayConfig.setMchId(paramObj.getString("mchId"));
    wxPayConfig.setAppId(paramObj.getString("appId"));
    wxPayConfig.setMchKey(paramObj.getString("key"));
    return wxPayConfig;
}