/// <summary> /// 返回预支付消息,由创建支付订单时的 notify_url 接收微信支付成功通知 /// </summary> public static weixin_pay_notify getPayNotify(HttpRequest req) { weixin_pay_notify notifyvo = new weixin_pay_notify(); StreamReader reader = new StreamReader(req.InputStream, System.Text.Encoding.GetEncoding("UTF-8")); String xmlData = reader.ReadToEnd(); LogHelper.Info("getPayNotify:" + xmlData); if (Util.isNotNull(xmlData)) { XmlDocument xml = new XmlDocument(); xml.LoadXml(xmlData); notifyvo = (weixin_pay_notify)Util.xmlToVO(xml, "DbModels.WeixinModels.weixin_pay_notify"); } return(notifyvo); }
public string FastBuyPayReceive() { HttpRequest request = System.Web.HttpContext.Current.Request; weixin_pay_notify payNotify = new weixin_pay_notify(); try { payNotify = WeixinPay.getPayNotify(request); if ("SUCCESS".Equals(payNotify.result_code)) { //BaseBLL<pay_record> payRecordBll = new BaseBLL<pay_record>(); //pay_record payRecord = payRecordBll.Find(x => x.pay_number == payNotify.out_trade_no); //if (payRecord != null) //{ // //标记支付记录回调成功 // double notify_money = double.Parse(payNotify.total_fee.ToString()) / 100; //payRecord.notify_money = notify_money; //payRecord.pay_success = 1; //payRecord.transaction_id = payNotify.transaction_id;//微信支付订单号 //payRecordBll.Update(payRecord); //Orderform.UpdateStatusPayByUnionnumber(payRecord.unionnumber); //} //else //{ // LogHelper.Error("未找到原始支付记录,无法回写支付状态,paynotifyvo.out_trade_no=" + payNotify.out_trade_no + "!"); //} } else { LogHelper.Error("return_code = " + payNotify.result_code); } } catch (Exception ex) { LogHelper.Error(ex.Message); } string ret = "<xml><return_code><![CDATA[SUCCESS]]></return_code><return_msg><![CDATA[OK]]></return_msg></xml>"; LogHelper.Info("FastBuyPayReceive return:" + ret); HttpContext.Current.Response.Write(ret); HttpContext.Current.Response.End(); return(ret); }