| | |
| | | import cn.binarywang.wx.miniapp.api.WxMaService; |
| | | import cn.binarywang.wx.miniapp.api.impl.WxMaServiceImpl; |
| | | import cn.binarywang.wx.miniapp.config.impl.WxMaDefaultConfigImpl; |
| | | import com.doumee.biz.system.SystemDictDataBiz; |
| | | import com.doumee.config.mybatis.SpringUtils; |
| | | import com.github.binarywang.wxpay.config.WxPayConfig; |
| | | import com.github.binarywang.wxpay.constant.WxPayConstants; |
| | | import com.github.binarywang.wxpay.service.WxPayService; |
| | | import com.github.binarywang.wxpay.service.impl.WxPayServiceImpl; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.context.annotation.Configuration; |
| | |
| | | public static WxMaService wxMaService; |
| | | /********微信小程序支付**********/ |
| | | public static WxPayService wxPayService; |
| | | /********微信APP支付**********/ |
| | | public static WxPayService wxAppPayService; |
| | | |
| | | |
| | | @Autowired |
| | | private WxPayProperties wxPayProperties; |
| | |
| | | @PostConstruct |
| | | void init() { |
| | | this.load_WxMaService(); |
| | | // this.load_wxPayService(); |
| | | // this.load_wxAppPayService(); |
| | | this.load_wxPayService(); |
| | | } |
| | | /** |
| | | * 初始化微信小程序 |
| | |
| | | /** |
| | | * 初始化微信小程序支付 |
| | | */ |
| | | // public void load_wxPayService() { |
| | | // WxPayConfig payConfig = new WxPayConfig(); |
| | | // payConfig.setTradeType(WxPayConstants.TradeType.JSAPI); |
| | | // payConfig.setSignType(WxPayConstants.SignType.MD5); |
| | | // payConfig.setAppId(StringUtils.trimToNull(wxPayProperties.getAppId())); |
| | | // payConfig.setMchId(StringUtils.trimToNull(wxPayProperties.getMchId())); |
| | | // payConfig.setMchKey(StringUtils.trimToNull(wxPayProperties.getMchKey())); |
| | | // payConfig.setKeyPath(StringUtils.trimToNull(wxPayProperties.getKeyPath())); |
| | | // payConfig.setNotifyUrl(StringUtils.trimToNull(wxPayProperties.getNotifyUrl())); |
| | | // WxPayService wxPayService = new WxPayServiceImpl(); |
| | | // wxPayService.setConfig(payConfig); |
| | | // this.wxPayService = wxPayService; |
| | | // } |
| | | public void load_wxPayService() { |
| | | WxPayConfig payConfig = new WxPayConfig(); |
| | | payConfig.setTradeType(WxPayConstants.TradeType.JSAPI); |
| | | payConfig.setSignType(WxPayConstants.SignType.MD5); |
| | | payConfig.setAppId(StringUtils.trimToNull(wxPayProperties.getAppId())); |
| | | payConfig.setMchId(StringUtils.trimToNull(wxPayProperties.getMchId())); |
| | | payConfig.setMchKey(StringUtils.trimToNull(wxPayProperties.getMchKey())); |
| | | payConfig.setKeyPath(StringUtils.trimToNull(wxPayProperties.getKeyPath())); |
| | | payConfig.setNotifyUrl(StringUtils.trimToNull(wxPayProperties.getNotifyUrl())); |
| | | WxPayService wxPayService = new WxPayServiceImpl(); |
| | | wxPayService.setConfig(payConfig); |
| | | this.wxPayService = wxPayService; |
| | | } |
| | | |
| | | |
| | | |
| | | // /** |
| | | // * 初始化App支付 |
| | | // */ |
| | | // public void load_wxAppPayService() { |
| | | // WxPayConfig payConfig = new WxPayConfig(); |
| | | // payConfig.setTradeType(WxPayConstants.TradeType.APP); |
| | | // payConfig.setSignType(WxPayConstants.SignType.MD5); |
| | | // payConfig.setAppId(""); |
| | | // payConfig.setMchId(StringUtils.trimToNull(sysDictService.getSysDictValue(SysDictEnum.WX_MINI_MchId.getCode()))); |
| | | // payConfig.setMchKey(StringUtils.trimToNull(sysDictService.getSysDictValue(SysDictEnum.WX_MINI_MchKey.getCode()))); |
| | | // payConfig.setKeyPath(StringUtils.trimToNull(sysDictService.getSysDictValue(SysDictEnum.WX_MINI_KeyPath.getCode()))); |
| | | // payConfig.setNotifyUrl(StringUtils.trimToNull(sysDictService.getSysDictValue(SysDictEnum.WX_MINI_NotifyUrl.getCode()))); |
| | | // WxPayService wxPayService = new WxPayServiceImpl(); |
| | | // wxPayService.setConfig(payConfig); |
| | | // this.wxAppPayService = wxPayService; |
| | | // } |
| | | |
| | | } |