| | |
| | | private final RestTemplateUtil restTemplateUtil; |
| | | private final PayHelper payHelper; |
| | | private final VirtualCardSv virtualCardSv; |
| | | private final String appid = com.dy.pipIrrWechat.wechatpay.PayInfo.appid; |
| | | private final String secret = com.dy.pipIrrWechat.wechatpay.PayInfo.secret; |
| | | private final String mchid = com.dy.pipIrrWechat.wechatpay.PayInfo.mchid; |
| | | //private final String appid = com.dy.pipIrrWechat.wechatpay.PayInfo.appid; |
| | | //private final String secret = com.dy.pipIrrWechat.wechatpay.PayInfo.secret; |
| | | //private final String mchid = com.dy.pipIrrWechat.wechatpay.PayInfo.mchid; |
| | | private final String schema = com.dy.pipIrrWechat.wechatpay.PayInfo.schema; |
| | | private final String signType = com.dy.pipIrrWechat.wechatpay.PayInfo.signType; |
| | | private final String description = com.dy.pipIrrWechat.wechatpay.PayInfo.description; |
| | |
| | | String jsCode = code2Session.getJs_code(); |
| | | |
| | | Map<String, Object> queryParams = new HashMap<>(); |
| | | queryParams.put("appid", appid); |
| | | queryParams.put("secret", secret); |
| | | queryParams.put("appid", PayInfo.appid); |
| | | queryParams.put("secret", PayInfo.secret); |
| | | queryParams.put("js_code", jsCode); |
| | | queryParams.put("grant_type", grantType); |
| | | Map<String, String> headerParams = new HashMap<>(); |
| | |
| | | } |
| | | |
| | | JSONObject job_body = new JSONObject(); |
| | | job_body.put("appid", appid); |
| | | job_body.put("mchid", mchid); |
| | | job_body.put("appid", PayInfo.appid); |
| | | job_body.put("mchid", PayInfo.mchid); |
| | | job_body.put("description", description); |
| | | job_body.put("out_trade_no", orderNumber); |
| | | job_body.put("attach", DataSourceContext.get()); |
| | |
| | | return BaseResponseUtils.buildFail("添加微信支付信息失败"); |
| | | } |
| | | return BaseResponseUtils.buildSuccess(true) ; |
| | | } |
| | | |
| | | /** |
| | | * 初始化微信支付信息 |
| | | * @param appId |
| | | * @return |
| | | */ |
| | | @PostMapping(path = "init_wechatpay") |
| | | public BaseResponse<Boolean> initWechatpay(@RequestParam("appId") String appId) throws Exception { |
| | | if(appId == null || appId.trim().length() == 0) { |
| | | return BaseResponseUtils.buildErrorMsg("小程序唯一标识不能为空"); |
| | | } |
| | | appId = AES.encrypt(appId); |
| | | |
| | | SeWechatpay seWechatpay = paymentSv.getWechatpayByAppId(appId); |
| | | if(seWechatpay != null) { |
| | | PayInfo.appid = AES.decrypt(seWechatpay.getAppId()); |
| | | PayInfo.secret = AES.decrypt(seWechatpay.getAppSecret()); |
| | | PayInfo.mchid = AES.decrypt(seWechatpay.getMchId()); |
| | | PayInfo.key = AES.decrypt(seWechatpay.getMchKey()); |
| | | PayInfo.serial_no = AES.decrypt(seWechatpay.getSerialNo()); |
| | | PayInfo.notifyUrl = AES.decrypt(seWechatpay.getNotifyUrl()); |
| | | return BaseResponseUtils.buildSuccess(true) ; |
| | | }else { |
| | | return BaseResponseUtils.buildErrorMsg("小程序唯一标识错误或其信息不存在"); |
| | | } |
| | | |
| | | } |
| | | } |