/// <summary> /// 处理微信支付结果信息 /// </summary> /// <param name="xml">结果信息</param> /// <returns></returns> public static void HandlePayMessage(string xml) { var doc = XDocument.Parse(xml); var model = new AuctionPaymentRecordModel(); model.FillEntityWithXml(doc); //待实现 }
public HttpResponseMessage WxPayBack() { var stream = Request.Content.ReadAsStringAsync().Result; LoggerFactories.CreateLogger().Write($"WxPay Result: {stream}", TraceEventType.Information); try { var doc = XDocument.Parse(stream); var model = new AuctionPaymentRecordModel(); model.FillEntityWithXml(doc); if (model.attach.Equals("kplx_auction")) { var resultPay = _auctionservice.GetAuctionParticipantByOrderNo(model.out_trade_no); var modelPay = (AuctionCarParticipantModel)resultPay.errmsg; //更新竞价 var upstatus = _auctionservice.UpdateStatusForPay(model.out_trade_no).errcode; if (upstatus != 0) { LoggerFactories.CreateLogger().Write("socket result : 支付定金完成,更新竞价状态出错!", TraceEventType.Information); } SendPost(modelPay.Innerid); } else if (model.attach.Equals("kplx_vip")|| model.attach.Equals("kplx_betavip")) //获取会员ID { var custservice = ServiceLocatorFactory.GetServiceLocator().GetService<ICustomerManagementService>(); var custResult = custservice.CustWeChatPayByorderno(model.out_trade_no); if (custResult.errcode == 0) { var custPayModel = (CustWxPayModel) custResult.errmsg; //更新会员状态 var ucstatus = custservice.CustWxPayVipBack(model.out_trade_no).errcode; if (ucstatus != 0) { LoggerFactories.CreateLogger().Write("socket result : 会员支付完成,更新状态出错!", TraceEventType.Information); } SendPost(custPayModel.Custid); } } else if(model.attach.Equals("kplx_activity_crowd")) //众筹活动支付 { var service = ServiceLocatorFactory.GetServiceLocator().GetService<IActivityManagementService>(); service.DoPay(model.out_trade_no); } else if (model.attach.Equals("kplx_mysterious")) //查看神秘车源支付回调 { var service = ServiceLocatorFactory.GetServiceLocator().GetService<ICarManagementService>(); service.DoPay(model.out_trade_no); } //记录支付结果 var result = _auctionservice.AddPaymentRecord(model); LoggerFactories.CreateLogger().Write($"WxPay Saved Result: {result.errcode}", TraceEventType.Information); return new HttpResponseMessage { Content = new StringContent("SUCCESS") }; } catch (Exception ex) { LoggerFactories.CreateLogger().Write($"WxPay Result Ex: {ex.Message}", TraceEventType.Information); return new HttpResponseMessage { Content = new StringContent("ERROR") }; } }
public HttpResponseMessage TestPayBack() { var stream = Request.Content.ReadAsStringAsync().Result; LoggerFactories.CreateLogger().Write($"WxPay Result: {stream}", TraceEventType.Information); try { var doc = XDocument.Parse(stream); var model = new AuctionPaymentRecordModel(); model.FillEntityWithXml(doc); //var result = _auctionservice.AddPaymentRecord(model); } catch (Exception ex) { LoggerFactories.CreateLogger().Write($"WxPay Result Ex: {ex.Message}", TraceEventType.Information); } //调用nodejs 通知前端 return new HttpResponseMessage { Content = new StringContent("") }; }