protected void Page_Load(object sender, EventArgs e) { log4net.LogManager.GetLogger("sgspay").Error("WxPay ResultNotifyPage."); ResultNotify resultNotify = new ResultNotify(this); resultNotify.ProcessNotify(); }
protected void Page_Load(object sender, EventArgs e) { if (!string.IsNullOrWhiteSpace(serial)) { //交易流水与支付接口 Song.Entities.MoneyAccount moneyAccount = Business.Do <IAccounts>().MoneySingle(serial); Song.Entities.PayInterface payInterface = Business.Do <IPayInterface>().PaySingle(moneyAccount.Pai_ID); total_fee = (int)(moneyAccount.Ma_Money * 100); //商户id与支付密钥 string appid = payInterface.Pai_ParterID; //绑定支付的APPID(必须配置) WeiSha.Common.CustomConfig config = CustomConfig.Load(payInterface.Pai_Config); string mchid = config["MCHID"].Value.String; //商户id string paykey = config["Paykey"].Value.String; //支付密钥 // WxPayData data = new WxPayData(); data.SetValue("out_trade_no", serial); //商户订单号 WxPayData result = WxPayApi.OrderQuery(data, appid, mchid, paykey); //提交订单查询请求给API,接收返回数据 Log.Info("OrderQuery", "订单查询结果GET, result : " + result.ToXml()); string state = result.GetValue("trade_state").ToString(); if (state == "SUCCESS") { //付款方与收款方(商户id) moneyAccount.Ma_Buyer = result.GetValue("attach").ToString(); moneyAccount.Ma_Seller = result.GetValue("mch_id").ToString(); Business.Do <IAccounts>().MoneyConfirm(moneyAccount); lbError.Visible = false; lbSucess.Visible = true; } else { lbError.Visible = true; lbSucess.Visible = false; } } else { //接收来自微信支付中心的异步请求 ResultNotify resultNotify = new ResultNotify(this); //resultNotify.ProcessNotify(); //获取结果 WxPayData notifyData = resultNotify.GetNotifyData(); string out_trade_no = notifyData.GetValue("out_trade_no").ToString(); Log.Info(this.GetType().ToString(), "商户流水号 : " + out_trade_no); if (!string.IsNullOrWhiteSpace(out_trade_no)) { Song.Entities.MoneyAccount maccount = Business.Do <IAccounts>().MoneySingle(out_trade_no); if (maccount != null) { //付款方与收款方(商户id) maccount.Ma_Buyer = notifyData.GetValue("attach").ToString(); maccount.Ma_Seller = notifyData.GetValue("mch_id").ToString(); Business.Do <IAccounts>().MoneyConfirm(maccount); } } } }
protected void Page_Load(object sender, EventArgs e) { ResultNotify resultNotify = new ResultNotify(this); //resultNotify.ProcessNotify(); //获取结果 WxPayData notifyData = resultNotify.GetNotifyData(); string out_trade_no = notifyData.GetValue("out_trade_no").ToString(); Log.Info(this.GetType().ToString(), "商户流水号 : " + out_trade_no); if (!string.IsNullOrWhiteSpace(out_trade_no)) { Song.Entities.MoneyAccount maccount = Business.Do <IAccounts>().MoneySingle(out_trade_no); if (maccount != null) { //付款方与收款方(商户id) maccount.Ma_Buyer = notifyData.GetValue("attach").ToString(); maccount.Ma_Seller = notifyData.GetValue("mch_id").ToString(); Business.Do <IAccounts>().MoneyConfirm(maccount); } } }
protected void Page_Load(object sender, EventArgs e) { ResultNotify resultNotify = new ResultNotify(this); resultNotify.ProcessNotify(); }
/// <summary> /// wx异步返回处理 /// </summary> /// <param name="context"></param> /// <returns></returns> public WxPayAPI.ResultNotify.WXPayBack WXJSApi_Notify(HttpContext context) { ResultNotify resultNotify = new ResultNotify(context); return resultNotify.ProcessNotify(); }