Search in sources :

Example 6 with WxPayService

use of com.github.binarywang.wxpay.service.WxPayService in project litemall by linlinjava.

the class WxPayConfiguration method wxPayService.

@Bean
public // @ConditionalOnMissingBean
WxPayService wxPayService(WxPayConfig payConfig) {
    WxPayService wxPayService = new WxPayServiceImpl();
    wxPayService.setConfig(payConfig);
    return wxPayService;
}
Also used : WxPayService(com.github.binarywang.wxpay.service.WxPayService) WxPayServiceImpl(com.github.binarywang.wxpay.service.impl.WxPayServiceImpl) ConditionalOnMissingBean(org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean) Bean(org.springframework.context.annotation.Bean)

Example 7 with WxPayService

use of com.github.binarywang.wxpay.service.WxPayService in project weixin-java-pay-demo by binarywang.

the class WxPayConfiguration method wxService.

@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()));
    // 可以指定是否使用沙箱环境
    payConfig.setUseSandboxEnv(false);
    WxPayService wxPayService = new WxPayServiceImpl();
    wxPayService.setConfig(payConfig);
    return wxPayService;
}
Also used : WxPayService(com.github.binarywang.wxpay.service.WxPayService) WxPayServiceImpl(com.github.binarywang.wxpay.service.impl.WxPayServiceImpl) WxPayConfig(com.github.binarywang.wxpay.config.WxPayConfig) ConditionalOnMissingBean(org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean) ConditionalOnMissingBean(org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean) Bean(org.springframework.context.annotation.Bean)

Aggregations

WxPayService (com.github.binarywang.wxpay.service.WxPayService)7 WxPayServiceImpl (com.github.binarywang.wxpay.service.impl.WxPayServiceImpl)7 Bean (org.springframework.context.annotation.Bean)5 ConditionalOnMissingBean (org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean)3 WxPayConfig (com.github.binarywang.wxpay.config.WxPayConfig)2 WxPayException (com.github.binarywang.wxpay.exception.WxPayException)2 R (com.github.liuweijw.commons.base.R)2 HashMap (java.util.HashMap)2 Map (java.util.Map)2 JSONObject (com.alibaba.fastjson.JSONObject)1 WxPayUnifiedOrderRequest (com.github.binarywang.wxpay.bean.request.WxPayUnifiedOrderRequest)1 WxPaySendRedpackResult (com.github.binarywang.wxpay.bean.result.WxPaySendRedpackResult)1 WxPayUnifiedOrderResult (com.github.binarywang.wxpay.bean.result.WxPayUnifiedOrderResult)1 Primary (org.springframework.context.annotation.Primary)1