You can not select more than 25 topics
			Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
		
		
		
		
			
				
					
					
						
							66 lines
						
					
					
						
							2.6 KiB
						
					
					
				
			
		
		
	
	
							66 lines
						
					
					
						
							2.6 KiB
						
					
					
				| //package com.ynxbd.wx.servlet.pay;
 | |
| //
 | |
| //import com.ynxbd.common.action.pay.PQREnum;
 | |
| //import com.ynxbd.common.bean.enums.MerchantEnum;
 | |
| //import com.ynxbd.common.helper.common.HttpHelper;
 | |
| //import com.ynxbd.common.result.Result;
 | |
| //import com.ynxbd.common.result.ServiceException;
 | |
| //import com.ynxbd.common.service.OutCollectService;
 | |
| //import com.ynxbd.wx.wxfactory.WxPayHelper;
 | |
| //import com.ynxbd.wx.wxfactory.bean.WxPayNotify;
 | |
| //import com.ynxbd.wx.wxfactory.utils.WxRespHelper;
 | |
| //import lombok.extern.slf4j.Slf4j;
 | |
| //import org.slf4j.MDC;
 | |
| //
 | |
| //import javax.servlet.annotation.WebServlet;
 | |
| //import javax.servlet.http.HttpServlet;
 | |
| //import javax.servlet.http.HttpServletRequest;
 | |
| //import javax.servlet.http.HttpServletResponse;
 | |
| //import java.math.BigDecimal;
 | |
| //
 | |
| ///**
 | |
| // * [微信]回调通知
 | |
| // *
 | |
| // * @Author wsq
 | |
| // * @Date 2020/11/19 10:36
 | |
| // * @Copyright @ 2020 云南新八达科技有限公司 All rights reserved.
 | |
| // */
 | |
| //@Slf4j
 | |
| //@WebServlet("/notify/wx_native_pay_notify_servlet")
 | |
| //public class WxNativePayNotifyServlet extends HttpServlet {
 | |
| //
 | |
| //    @Override
 | |
| //    protected void doPost(HttpServletRequest request, HttpServletResponse response) {
 | |
| //        MDC.remove("ip");
 | |
| //        MDC.put("ip", HttpHelper.getIpAddress(request));
 | |
| //
 | |
| //        try {
 | |
| //            WxPayNotify notifyInfo = WxPayHelper.newPayNotify(request);
 | |
| //            Result.respXml(response, WxRespHelper.respOk()); // 收到请求-解析成功
 | |
| //
 | |
| //            String openid = notifyInfo.getOpenid();
 | |
| //            String bankTransNo = notifyInfo.getTransactionId();
 | |
| //            String outTradeNo = notifyInfo.getOutTradeNo();
 | |
| //            String payInfo = notifyInfo.getPayInfo();
 | |
| //            BigDecimal totalFee = notifyInfo.getTotalFee();
 | |
| //
 | |
| //            String notifyType = notifyInfo.getAttach();
 | |
| //
 | |
| //            log.info("notifyInfo={}", notifyInfo);
 | |
| //            log.info("【微信native支付】[{}] 收到通知 outTradeNo={}, bankTransNo={}", notifyType, outTradeNo, bankTransNo);
 | |
| //
 | |
| //            switch (PQREnum.toEnum(notifyType)) {
 | |
| //                case OUT_COLLECT:
 | |
| //                    new OutCollectService().ocPayNotify(MerchantEnum.WX, openid, totalFee, bankTransNo, outTradeNo, payInfo);
 | |
| //                    break;
 | |
| //
 | |
| //                default:
 | |
| //                    log.info("【微信native支付】通知类型错误,结束请求");
 | |
| //                    break;
 | |
| //            }
 | |
| //
 | |
| //        } catch (ServiceException e) {
 | |
| //            Result.respXml(response, WxRespHelper.resp(e)); // 收到请求-解析失败
 | |
| //        }
 | |
| //    }
 | |
| //}
 | |
| 
 |