doum
2025-09-15 82735e4d46ac7b9969facef2acc8f8e793b68f71
server/admin/src/main/java/com/doumee/api/business/PaymentCallback.java
@@ -1,6 +1,7 @@
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;
@@ -59,6 +60,7 @@
     */
    @PostMapping("/web/wxPayNotify")
    public ApiResponse wxPay_notify(HttpServletRequest request) {
        log.error("微信支付回调结果开始===========" );
        try {
            ServletInputStream inputStream = request.getInputStream();
            StringBuffer stringBuffer = new StringBuffer();
@@ -83,9 +85,11 @@
                    .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();
@@ -95,6 +99,7 @@
            Transaction result = parser.parse(requestParam, Transaction.class);
            log.error("支付回调信息:{}"+ JSONObject.toJSONString(result));
            //自定义订单号
            String outTradeNo = result.getOutTradeNo();
            //微信订单号
@@ -111,11 +116,12 @@
            } else {
                // 支付失败
                switch (result.getAttach()) {
                    case "createGoodsOrder": {
                    case "createOrder": {
                        break;
                    }
                }
            }
            log.error("微信支付回调结果结束===========" );
            return ApiResponse.success("处理成功!");
        } catch (Exception e) {
            e.printStackTrace();
@@ -152,13 +158,20 @@
                    .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);
@@ -194,7 +207,7 @@
                .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);