|  |  |  | 
|---|
|  |  |  | package com.doumee.api.business; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import com.alibaba.fastjson.JSON; | 
|---|
|  |  |  | import com.alibaba.fastjson.JSONObject; | 
|---|
|  |  |  | import com.doumee.config.wx.TransferDetailEntityNew; | 
|---|
|  |  |  | import com.doumee.config.wx.WxMiniConfig; | 
|---|
|  |  |  | import com.doumee.core.constants.Constants; | 
|---|
|  |  |  | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | @PostMapping("/web/wxPayNotify") | 
|---|
|  |  |  | public ApiResponse wxPay_notify(HttpServletRequest request) { | 
|---|
|  |  |  | log.error("微信支付回调结果开始===========" ); | 
|---|
|  |  |  | try { | 
|---|
|  |  |  | ServletInputStream inputStream = request.getInputStream(); | 
|---|
|  |  |  | StringBuffer stringBuffer = new StringBuffer(); | 
|---|
|  |  |  | 
|---|
|  |  |  | .body(body) | 
|---|
|  |  |  | .build(); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | NotificationConfig config = new RSAAutoCertificateConfig.Builder() | 
|---|
|  |  |  | NotificationConfig config = new RSAPublicKeyConfig.Builder() | 
|---|
|  |  |  | .merchantId(WxMiniConfig.wxProperties.getMchId()) | 
|---|
|  |  |  | .privateKeyFromPath(WxMiniConfig.wxProperties.getPrivateKeyPath()) | 
|---|
|  |  |  | .publicKeyFromPath(WxMiniConfig.wxProperties.getPubKeyPath()) | 
|---|
|  |  |  | .publicKeyId(WxMiniConfig.wxProperties.getPayPublicKeyId()) | 
|---|
|  |  |  | .merchantSerialNumber(WxMiniConfig.wxProperties.getSerialNumer()) | 
|---|
|  |  |  | .apiV3Key(WxMiniConfig.wxProperties.getApiV3Key()) | 
|---|
|  |  |  | .build(); | 
|---|
|  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | Transaction result = parser.parse(requestParam, Transaction.class); | 
|---|
|  |  |  | log.error("支付回调信息:{}"+ JSONObject.toJSONString(result)); | 
|---|
|  |  |  | //自定义订单号 | 
|---|
|  |  |  | String outTradeNo = result.getOutTradeNo(); | 
|---|
|  |  |  | //微信订单号 | 
|---|
|  |  |  | 
|---|
|  |  |  | } else { | 
|---|
|  |  |  | // 支付失败 | 
|---|
|  |  |  | switch (result.getAttach()) { | 
|---|
|  |  |  | case "createGoodsOrder": { | 
|---|
|  |  |  | case "createOrder": { | 
|---|
|  |  |  | break; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | log.error("微信支付回调结果结束===========" ); | 
|---|
|  |  |  | return ApiResponse.success("处理成功!"); | 
|---|
|  |  |  | } catch (Exception e) { | 
|---|
|  |  |  | e.printStackTrace(); | 
|---|
|  |  |  | 
|---|
|  |  |  | .body(body) | 
|---|
|  |  |  | .build(); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | NotificationConfig config = new RSAAutoCertificateConfig.Builder() | 
|---|
|  |  |  | NotificationConfig config = /*new RSAAutoCertificateConfig.Builder() | 
|---|
|  |  |  | .merchantId(WxMiniConfig.wxProperties.getMchId()) | 
|---|
|  |  |  | .privateKeyFromPath(WxMiniConfig.wxProperties.getPrivateKeyPath()) | 
|---|
|  |  |  | .merchantSerialNumber(WxMiniConfig.wxProperties.getSerialNumer()) | 
|---|
|  |  |  | .apiV3Key(WxMiniConfig.wxProperties.getApiV3Key()) | 
|---|
|  |  |  | .build();*/ | 
|---|
|  |  |  | new RSAPublicKeyConfig.Builder() | 
|---|
|  |  |  | .merchantId(WxMiniConfig.wxProperties.getMchId()) | 
|---|
|  |  |  | .privateKeyFromPath(WxMiniConfig.wxProperties.getPrivateKeyPath()) | 
|---|
|  |  |  | .publicKeyFromPath(WxMiniConfig.wxProperties.getPubKeyPath()) | 
|---|
|  |  |  | .publicKeyId(WxMiniConfig.wxProperties.getPayPublicKeyId()) | 
|---|
|  |  |  | .merchantSerialNumber(WxMiniConfig.wxProperties.getSerialNumer()) | 
|---|
|  |  |  | .apiV3Key(WxMiniConfig.wxProperties.getApiV3Key()) | 
|---|
|  |  |  | .build(); | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | NotificationParser parser = new NotificationParser(config); | 
|---|
|  |  |  | RefundNotification result = parser.parse(requestParam, RefundNotification.class); | 
|---|
|  |  |  | 
|---|
|  |  |  | .publicKeyFromPath(WxMiniConfig.wxProperties.getWechatPubKeyPath()) //微信支付公钥的存放路径 | 
|---|
|  |  |  | .publicKeyId(WxMiniConfig.wxProperties.getWechatPayPublicKeyId()) //微信支付公钥ID | 
|---|
|  |  |  | .merchantSerialNumber(WxMiniConfig.wxProperties.getWechatSerialNumer()) //商户API证书序列号 | 
|---|
|  |  |  | .apiV3Key("7tG4Vk9Zp2L8dXw5Jq0N3hR6yE1sF3cB") //APIv3密钥 | 
|---|
|  |  |  | .apiV3Key(WxMiniConfig.wxProperties.getWechatApiV3Key()) //APIv3密钥 | 
|---|
|  |  |  | .build(); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | TransferDetailEntityNew entity = wxSuccessCallback(request,config); | 
|---|