public VWPayOrderEntity GetVWPayOrderByPayCode(string payordercode) { string sql = @"SELECT [Id],[PayOrderCode],[SysOrderCode],[SysType],[NeedPayPrice],[PayMethod],[CreateTime],[CreateManId],[Status],[PayTime],ExternalCode,PayPrice FROM dbo.[PayOrder] WITH(NOLOCK) WHERE [PayOrderCode]=@PayOrderCode" ; DbCommand cmd = db.GetSqlStringCommand(sql); db.AddInParameter(cmd, "@PayOrderCode", DbType.String, payordercode); VWPayOrderEntity entity = new VWPayOrderEntity(); using (IDataReader reader = db.ExecuteReader(cmd)) { if (reader.Read()) { entity.Id = StringUtils.GetDbInt(reader["Id"]); entity.PayOrderCode = StringUtils.GetDbString(reader["PayOrderCode"]); entity.SysOrderCode = StringUtils.GetDbString(reader["SysOrderCode"]); entity.SysType = StringUtils.GetDbInt(reader["SysType"]); entity.NeedPayPrice = StringUtils.GetDbDecimal(reader["NeedPayPrice"]); entity.PayMethod = StringUtils.GetDbInt(reader["PayMethod"]); entity.CreateTime = StringUtils.GetDbDateTime(reader["CreateTime"]); entity.CreateManId = StringUtils.GetDbInt(reader["CreateManId"]); entity.Status = StringUtils.GetDbInt(reader["Status"]); entity.PayTime = StringUtils.GetDbDateTime(reader["PayTime"]); entity.ExternalCode = StringUtils.GetDbString(reader["ExternalCode"]); entity.PayPrice = StringUtils.GetDbDecimal(reader["PayPrice"]); } } return(entity); }
/** * 调用统一下单,获得下单结果 * @return 统一下单结果 * @失败时抛异常WxPayException */ public WxPayData GetUnifiedOrderResult(VWPayOrderEntity _order) { //统一下单 WxPayData data = new WxPayData(); data.SetValue("body", "易店心,订单号:" + _order.SysOrderCode); data.SetValue("attach", ""); data.SetValue("out_trade_no", _order.PayOrderCode);/*WxPayApi.GenerateOutTradeNo()*/ data.SetValue("total_fee", (_order.NeedPayPrice * 100).ToString()); data.SetValue("time_start", DateTime.Now.ToString("yyyyMMddHHmmss")); data.SetValue("time_expire", DateTime.Now.AddMinutes(10).ToString("yyyyMMddHHmmss")); data.SetValue("goods_tag", ""); data.SetValue("trade_type", "JSAPI"); data.SetValue("openid", openid); WxPayData result = WxPayApi.UnifiedOrder(data); if (!result.IsSet("appid") || !result.IsSet("prepay_id") || result.GetValue("prepay_id").ToString() == "") { WxLog.Error(this.GetType().ToString(), "UnifiedOrder response error!"); throw new WxPayException("UnifiedOrder response error!"); } unifiedOrderResult = result; return(result); }
public ActionResult WeiXin() { if (Globals.IsWeiXinDevice()) { //是微信客户端走这边 string wechatcode = QueryString.SafeQ("wechatcode"); if (string.IsNullOrEmpty(wechatcode)) { string url = Request.Url.ToString(); string redirecturl = string.Format(WeiXinConfig.URL_WeiXin_Redirect, WeiXinConfig.GetAppId(), System.Web.HttpContext.Current.Server.UrlEncode(url), "0"); return(Redirect(redirecturl)); } else { MemWeChatMsgEntity msg = WeiXinJsSdk.Instance.GetWeChatShortInfo(wechatcode); string _paycode = QueryString.SafeQ("paycode"); VWPayOrderEntity _payen = PayOrderBLL.Instance.GetVWPayOrderByPayCode(_paycode); string redirecturl = string.Format(WeiXinConfig.URL_Pay_InWeiXin, msg.OpenId, _payen.NeedPayPrice); Response.Redirect(redirecturl); } } else { //网站类调出微信端支付通道 string _paycode = QueryString.SafeQ("paycode"); VWPayOrderEntity _payen = PayOrderBLL.Instance.GetVWPayOrderByPayCode(_paycode); DateTime dtnow = DateTime.Now; NativePay nativePay = new NativePay(); WxPayData data = nativePay.GetPayUrl(_payen, "MWEB");//得到调用微信接口的路径 string url = data.GetValue("mweb_url").ToString(); return(Redirect(url)); } return(View()); }
public void WeiXinNotify() { ResultNotify resultNotify = new ResultNotify(); WxPayData notifyData = resultNotify.GetNotifyData(); LogUtil.Log("微信支付返回接口接收:", notifyData.ToXml()); if (notifyData.GetValue("return_code") != null && (notifyData.GetValue("return_code").ToString() == "SUCCESS") && notifyData.GetValue("out_trade_no") != null && notifyData.GetValue("transaction_id") != null) { string paycode = notifyData.GetValue("out_trade_no").ToString(); decimal fee = StringUtils.GetDbDecimal(notifyData.GetValue("total_fee")) / 100; VWPayOrderEntity payentity = PayOrderBLL.Instance.GetVWPayOrderByPayCode(paycode); if (payentity.Id > 0 && payentity.Status == 0)//未支付完成 { payentity.PayTime = DateTime.Now; payentity.PayPrice = fee; payentity.ExternalCode = notifyData.GetValue("transaction_id").ToString(); payentity.Status = 1; //先更新业务网站收款记录 if (payentity.SysType == (int)SystemType.B2B || payentity.SysType == (int)SystemType.B2BMobile) { VWOrderEntity _order = OrderBLL.Instance.GetVWOrderByCode(StringUtils.GetDbLong(payentity.SysOrderCode)); if (_order.Status == (int)OrderStatus.WaitPay) { if (OrderBLL.Instance.PayFinishedForOrder(StringUtils.GetDbLong(payentity.SysOrderCode), fee) > 0) { ///业务网站状态更新后更新支付总表 PayOrderBLL.Instance.RecivedPaySuccess(payentity); } } } } } }
public ActionResult PayReback() { string _paycode = QueryString.SafeQ("paycode"); VWPayOrderEntity enrity = PayOrderBLL.Instance.GetVWPayOrderByPayCode(_paycode); ViewBag.Entity = enrity; return(View()); }
public ActionResult OrderNotice() { string paycode = QueryString.SafeQ("code"); VWPayOrderEntity _orderentity = PayOrderBLL.Instance.GetVWPayOrderByPayCode(paycode); //long ordecode = QueryString.LongIntSafeQ("code"); //VWOrderEntity _orderentity = OrderBLL.Instance.GetVWOrderByCode(ordecode); ViewBag.Order = _orderentity; return(View()); }
public ActionResult WeiXin() { string _paycode = QueryString.SafeQ("paycode"); VWPayOrderEntity _payen = PayOrderBLL.Instance.GetVWPayOrderByPayCode(_paycode); DateTime dtnow = DateTime.Now; NativePay nativePay = new NativePay(); WxPayData data = nativePay.GetPayUrl(_payen); string url = data.GetValue("code_url").ToString();//获得统一下单接口返回的二维码链接 ViewBag.Url = url; return(View()); }
public string GetPayStatus() { ResultObj _result = new ResultObj(); string _paycode = FormString.SafeQ("paycode"); VWPayOrderEntity _payen = PayOrderBLL.Instance.GetVWPayOrderByPayCode(_paycode); if (_payen != null && _payen.Id > 0) { _result.Status = (int)CommonStatus.Success; _result.Obj = _payen.Status; } return(JsonJC.ObjectToJson(_result)); }
public int RecivedPaySuccess(VWPayOrderEntity entity) { string sql = @" UPDATE dbo.[PayOrder] SET [Status]=@Status,[PayTime]=@PayTime,ExternalCode=@ExternalCode,PayPrice=@PayPrice WHERE [Id]=@Id"; DbCommand cmd = db.GetSqlStringCommand(sql); db.AddInParameter(cmd, "@Id", DbType.Int32, entity.Id); db.AddInParameter(cmd, "@Status", DbType.Int32, entity.Status); db.AddInParameter(cmd, "@PayTime", DbType.DateTime, entity.PayTime); db.AddInParameter(cmd, "@PayPrice", DbType.Decimal, entity.PayPrice); db.AddInParameter(cmd, "@ExternalCode", DbType.String, entity.ExternalCode); return(db.ExecuteNonQuery(cmd)); }
/// <summary> /// 支付通道,手机网站同 /// </summary> /// <returns></returns> public ActionResult Cashier() { string paycode = QueryString.SafeQ("code"); VWPayOrderEntity _orderentity = PayOrderBLL.Instance.GetVWPayOrderByPayCode(paycode); if (_orderentity.PayMethod == (int)PayType.OutLine) { return(RedirectToAction("OrderNotice", new { code = _orderentity.SysOrderCode })); } if (Globals.IsWeiXinDevice() && (_orderentity.PayMethod == (int)PayType.AliPay || _orderentity.PayMethod == (int)PayType.AliPayMobile)) { return(View()); } //if (_orderentity.Status == (int)OrderStatus.WaitPay) if (_orderentity.Status == 0) { //PayEBankEntity _bank = new PayEBankEntity(); //PayEBankEntity _bank = PayEBankBLL.Instance.GetPayEBankByPayType(_orderentity.PayType); //PayTradeEntity _trade = PayTradeBLL.Instance.GetPayTradeByOrder(_orderentity.Code); //_trade.PayCode = _orderentity.Code.ToString(); //_trade.OrderCode = _orderentity.Code; //_trade.OrderAmount = _orderentity.ActPrice; ////_trade.OrderAmount =0.03m; //bool savesuccess = false; //if (_trade.Id == 0) //{ //if ((_trade.Id = PayTradeBLL.Instance.AddPayTrade(_trade)) > 0) // savesuccess = true; //} //else if (PayTradeBLL.Instance.UpdatePayTrade(_trade) > 0) //{ // savesuccess = true; //} //if (savesuccess) //{ SuperMarket.Pay.PaymentRequest.Instance(((PayType)_orderentity.PayMethod).ToString()).SendRequest(_orderentity);//请求支付 //} } else if (_orderentity.Status == 1) { Response.Write("已支付"); } else { Response.Write("11111"); } return(View()); }
public ActionResult OrderConfirmPay() { string paycode = QueryString.SafeQ("code"); VWPayOrderEntity _payen = PayOrderBLL.Instance.GetVWPayOrderByPayCode(paycode); if (_payen.PayMethod == (int)PayType.AliPay || _payen.PayMethod == (int)PayType.AliPayMobile) { return(RedirectToAction("Cashier", new { code = _payen.PayOrderCode })); } else if (_payen.PayMethod == (int)PayType.WeChat) { return(RedirectToAction("WeiXin", new { paycode = _payen.PayOrderCode })); } else if (_payen.PayMethod == (int)PayType.OutLine) { return(RedirectToAction("OrderNotice", new { code = _payen.PayOrderCode })); } return(View()); }
public override void SendRequest(VWPayOrderEntity tradeEntity) { this.out_trade_no = tradeEntity.PayOrderCode.ToString(); this.subject = "易店心订单号:" + tradeEntity.SysOrderCode.ToString(); this.price = "0.01";// tradeEntity.NeedPayPrice.ToString(); string paymethod = "bankPay"; string sign = ""; SortedDictionary <string, string> sParaTemp = new SortedDictionary <string, string>(); sParaTemp.Add("service", alipayConfig.service); sParaTemp.Add("partner", alipayConfig.partner); sParaTemp.Add("seller_id", alipayConfig.seller_id); sParaTemp.Add("_input_charset", alipayConfig.input_charset.ToLower()); sParaTemp.Add("payment_type", alipayConfig.payment_type); sParaTemp.Add("notify_url", alipayConfig.notify_url); sParaTemp.Add("return_url", alipayConfig.return_url); sParaTemp.Add("anti_phishing_key", alipayConfig.anti_phishing_key); sParaTemp.Add("exter_invoke_ip", alipayConfig.exter_invoke_ip); sParaTemp.Add("out_trade_no", out_trade_no); sParaTemp.Add("subject", subject); sParaTemp.Add("total_fee", price); sParaTemp.Add("body", body); Dictionary <string, string> sPara = new Dictionary <string, string>(); //签名结果 string mysign = ""; //过滤签名参数数组 sPara = alipayCore.FilterPara(sParaTemp); //获得签名结果 mysign = BuildRequestMysign(sPara); sPara.Add("sign", mysign); sPara.Add("sign_type", sign_type); StringBuilder builder = new StringBuilder(); foreach (KeyValuePair <string, string> temp in sPara) { builder.Append(this.CreateField(temp.Key, temp.Value)); } this.SubmitPaymentForm(this.CreateForm(builder.ToString(), this.gateway + "_input_charset=" + alipayConfig.input_charset.ToLower())); }
public string PayRebackSubmit() { ResultObj _obj = new ResultObj(); string paycode = FormString.SafeQ("paycode"); string rebackremark = FormString.SafeQ("rebackremark"); decimal rebackprice = FormString.DecimalSafeQ("rebackprice"); VWPayOrderEntity order = PayOrderBLL.Instance.GetVWPayOrderByPayCode(paycode); IList <PayOrderRebackEntity> rebacklist = PayOrderRebackBLL.Instance.GetRebackByPayCode(paycode); decimal hasreback = 0; if (rebacklist != null && rebacklist.Count > 0) { foreach (PayOrderRebackEntity reback in rebacklist) { hasreback += reback.RebackPrice; } } if (order.PayPrice - hasreback >= rebackprice)//金额满足退款条件(退款金额<=付款金额) { PayOrderRebackEntity reback = new PayOrderRebackEntity(); reback.ExternalCode = order.ExternalCode; reback.PayMethod = order.PayMethod; reback.PayOrderCode = order.PayOrderCode; reback.TotalPrice = order.PayPrice; reback.RebackPrice = rebackprice; reback.RebackRemark = rebackremark; reback.Status = 0; reback.SysOrderCode = order.SysOrderCode; reback.SysType = order.SysType; PayOrderRebackEntity rebackadd = PayOrderRebackBLL.Instance.AddPayOrderReback(reback); if (reback.PayMethod == (int)PayType.WeChat) { string result = Refund.Run(reback); _obj.Status = (int)CommonStatus.Success; } else if (reback.PayMethod == (int)PayType.AliPay || reback.PayMethod == (int)PayType.AliPayMobile) { _obj.Status = (int)CommonStatus.Success; } } return(JsonJC.ObjectToJson(_obj)); }
/** * 生成直接支付url,支付url有效期为2小时,模式二,默认tradetype是二维码 * @param productId 商品ID * @return 模式二URL */ public WxPayData GetPayUrl(VWPayOrderEntity payorder, string tradetype = "NATIVE") { WxPayData data = new WxPayData(); data.SetValue("body", "易店心:订单号" + payorder.SysOrderCode); //商品描述 data.SetValue("attach", "来源系统:" + payorder.SysType); //附加数据 data.SetValue("out_trade_no", payorder.PayOrderCode); //随机字符串 data.SetValue("total_fee", 1); //总金额 data.SetValue("time_start", DateTime.Now.ToString("yyyyMMddHHmmss")); //交易起始时间 data.SetValue("time_expire", DateTime.Now.AddMinutes(10).ToString("yyyyMMddHHmmss")); //交易结束时间 data.SetValue("goods_tag", ""); //商品标记 data.SetValue("trade_type", tradetype); //交易类型 data.SetValue("product_id", ""); //商品ID WxPayData result = WxPayApi.UnifiedOrder(data); //调用统一下单接口 return(result); }
public ActionResult WeiXin() { string _paycode = QueryString.SafeQ("paycode"); VWPayOrderEntity _payen = PayOrderBLL.Instance.GetVWPayOrderByPayCode(_paycode); DateTime dtnow = DateTime.Now; NativePay nativePay = new NativePay(); WxPayData data = nativePay.GetPayUrl(_payen); if (data.GetValue("result_code").ToString().ToLower() == "success") { string url = data.GetValue("code_url").ToString();//获得统一下单接口返回的二维码链接 ViewBag.Url = url; } else { string error = data.GetValue("err_code_des").ToString(); ViewBag.ErrorMsg = error; } ViewBag.PayEntity = _payen; return(View()); }
public ActionResult OrderConfirm() { string paycode = QueryString.SafeQ("code"); int success = QueryString.IntSafeQ("s"); //是否需要订单成功提醒 int freshnum = QueryString.IntSafeQ("fn"); //循环次数,超过10次自动关闭 if (freshnum > 10) { return(null); } VWPayOrderEntity _payen = PayOrderBLL.Instance.GetVWPayOrderByPayCode(paycode); if (_payen.PayMethod == (int)PayType.WeChat)//微信支付 { if (Globals.IsWeiXinDevice()) { string wechatcode = ""; wechatcode = QueryString.SafeQ("wechatcode"); //是微信客户端走这边 if (string.IsNullOrEmpty(wechatcode)) { //没有获取微信授权码 string url = Request.Url.ToString(); string redirecturl = string.Format(WeiXinConfig.URL_WeiXin_Redirect, WeiXinConfig.GetAppId(), System.Web.HttpContext.Current.Server.UrlEncode(url), "0"); return(Redirect(redirecturl)); } else { //有微信授权码 JsApiPay jsApiPay = new JsApiPay(); try { jsApiPay.GetOpenidAndAccessTokenFromCode(wechatcode); } catch (Exception ex) { //授权码过期 string baseurl; Dictionary <string, string> nvc = new Dictionary <string, string>(); string oldurl = Request.Url.ToString(); StringUtils.ParseUrl(oldurl, out baseurl, out nvc); nvc.Remove("wechatcode"); if (nvc.ContainsKey("fn")) { nvc["fn"] = (StringUtils.GetDbInt(nvc["fn"]) + 1).ToString(); } else { nvc.Add("fn", "1"); } string url = baseurl + "?"; foreach (string key in nvc.Keys) { url += "&" + key + "=" + nvc[key]; } string redirecturl = string.Format(WeiXinConfig.URL_WeiXin_Redirect, WeiXinConfig.GetAppId(), System.Web.HttpContext.Current.Server.UrlEncode(url), "0"); return(Redirect(redirecturl)); } WxPayData paydata = jsApiPay.GetUnifiedOrderResult(_payen); string wxJsApiParam = jsApiPay.GetJsApiParameters();//获取H5调起JS API参数 ViewBag.WeiXinJsApiParam = wxJsApiParam; } } else { //网站类调出微信端支付通道 DateTime dtnow = DateTime.Now; NativePay nativePay = new NativePay(); WxPayData data = nativePay.GetPayUrl(_payen, "MWEB");//得到调用微信接口的路径 string url = data.GetValue("mweb_url").ToString(); return(Redirect(url)); } } ViewBag.PayOrderEntity = _payen; ViewBag.Success = success; return(View()); }
/// <summary> /// 读取记录列表。 /// </summary> /// <param name="db">数据库操作对象</param> /// <param name="columns">需要返回的列,不提供任何列名时默认将返回所有列</param> public IList <VWPayOrderEntity> GetVWPayOrderList(int pagesize, int pageindex, ref int recordCount, string paycode, string syscode, int paymethod, int systype) { string where = " where 1=1 "; if (!string.IsNullOrEmpty(paycode)) { where += " and PayOrderCode=@PayOrderCode "; } if (!string.IsNullOrEmpty(syscode)) { where += " and SysOrderCode=@SysOrderCode "; } if (paymethod > 0) { where += " and PayMethod=@PayMethod "; } if (systype > 0) { where += " and SysType=@SysType "; } string sql = @"SELECT [Id],[PayOrderCode],[SysOrderCode],[SysType],[NeedPayPrice],[PayMethod],[CreateTime],[CreateManId],[Status],[PayTime],[PayPrice],[ExternalCode] FROM (SELECT ROW_NUMBER() OVER (ORDER BY Id desc) AS ROWNUMBER, [Id],[PayOrderCode],[SysOrderCode],[SysType],[NeedPayPrice],[PayMethod],[CreateTime],[CreateManId],[Status],[PayTime],[PayPrice],[ExternalCode] from dbo.[PayOrder] WITH(NOLOCK) " + where + @" ) as temp where rownumber BETWEEN ((@PageIndex - 1) * @PageSize + 1) AND @PageIndex * @PageSize" ; string sql2 = @"Select count(1) from dbo.[PayOrder] with (nolock) " + where; IList <VWPayOrderEntity> entityList = new List <VWPayOrderEntity>(); DbCommand cmd = db.GetSqlStringCommand(sql); db.AddInParameter(cmd, "@PageIndex", DbType.Int32, pageindex); db.AddInParameter(cmd, "@PageSize", DbType.Int32, pagesize); if (!string.IsNullOrEmpty(paycode)) { db.AddInParameter(cmd, "@PayOrderCode", DbType.String, paycode); } if (!string.IsNullOrEmpty(syscode)) { db.AddInParameter(cmd, "@SysOrderCode", DbType.String, syscode); } if (paymethod > 0) { db.AddInParameter(cmd, "@PayMethod", DbType.Int32, paymethod); } if (systype > 0) { db.AddInParameter(cmd, "@SysType", DbType.Int32, systype); } using (IDataReader reader = db.ExecuteReader(cmd)) { while (reader.Read()) { VWPayOrderEntity entity = new VWPayOrderEntity(); entity.Id = StringUtils.GetDbInt(reader["Id"]);; entity.PayOrderCode = StringUtils.GetDbString(reader["PayOrderCode"]);; entity.SysOrderCode = StringUtils.GetDbString(reader["SysOrderCode"]);; entity.SysType = StringUtils.GetDbInt(reader["SysType"]);; entity.NeedPayPrice = StringUtils.GetDbDecimal(reader["NeedPayPrice"]);; entity.PayMethod = StringUtils.GetDbInt(reader["PayMethod"]);; entity.CreateTime = StringUtils.GetDbDateTime(reader["CreateTime"]);; entity.CreateManId = StringUtils.GetDbInt(reader["CreateManId"]);; entity.Status = StringUtils.GetDbInt(reader["Status"]);; entity.PayTime = StringUtils.GetDbDateTime(reader["PayTime"]);; entity.PayPrice = StringUtils.GetDbDecimal(reader["PayPrice"]);; entity.ExternalCode = StringUtils.GetDbString(reader["ExternalCode"]); entityList.Add(entity); } } cmd = db.GetSqlStringCommand(sql2); if (!string.IsNullOrEmpty(paycode)) { db.AddInParameter(cmd, "@PayOrderCode", DbType.String, paycode); } if (!string.IsNullOrEmpty(syscode)) { db.AddInParameter(cmd, "@SysOrderCode", DbType.String, syscode); } if (paymethod > 0) { db.AddInParameter(cmd, "@PayMethod", DbType.Int32, paymethod); } if (systype > 0) { db.AddInParameter(cmd, "@SysType", DbType.Int32, systype); } using (IDataReader reader = db.ExecuteReader(cmd)) { if (reader.Read()) { recordCount = StringUtils.GetDbInt(reader[0]); } else { recordCount = 0; } } return(entityList); }
/// <summary> /// 阿里支付结果 /// </summary> /// <returns></returns> public ActionResult PayAliPayResult() { SortedDictionary <string, string> sPara = GetRequestGet(); if (sPara.Count > 0)//判断是否有带返回参数 { alipayNotify aliNotify = new alipayNotify(); bool verifyResult = aliNotify.Verify(sPara, Request.QueryString["notify_id"], Request.QueryString["sign"]); //验证消息是否是支付宝发出的合法消息 if (verifyResult) //验证成功 { ///////////////////////////////////////////////////////////////////////////////////////////////////////////// //请在这里加上商户的业务逻辑程序代码 //——请根据您的业务逻辑来编写程序(以下代码仅作参考)—— //获取支付宝的通知返回参数,可参考技术文档中页面跳转同步通知参数列表 //商户订单号 string out_trade_no = Request.QueryString["out_trade_no"]; //支付宝交易号 string trade_no = Request.QueryString["trade_no"]; //交易状态 string trade_status = Request.QueryString["trade_status"]; // string buyer_email = Request.QueryString["buyer_email"]; //lgzh306%40126.com string buyer_id = Request.QueryString["buyer_id"]; //2088602184028472 string exterface = Request.QueryString["exterface"]; //create_direct_pay_by_user string is_success = Request.QueryString["is_success"]; //T string notify_id = Request.QueryString["notify_id"]; //RqPnCoPT3K9%252Fvwbh3InWeOSzrvky7IAV3JJOfdsL5TFWKbTMC8BGq%252Bm99WAaYWgnOmS6 string notify_time = Request.QueryString["notify_time"]; //2016-10-10+15%3A48%3A34 string notify_type = Request.QueryString["notify_type"]; //trade_status_sync string payment_type = Request.QueryString["payment_type"]; //1 string seller_email = Request.QueryString["seller_email"]; //20718505%40qq.com string seller_id = Request.QueryString["seller_id"]; //2088421564177650 string subject = Request.QueryString["subject"]; //111 string total_fee = Request.QueryString["total_fee"]; //0.01 //http://pay.ddbbqp.com/return_url.aspx?buyer_email=lgzh306%40126.com&buyer_id=2088602184028472&exterface=create_direct_pay_by_user&is_success=T¬ify_id=RqPnCoPT3K9%252Fvwbh3InWeOSzrvky7IAV3JJOfdsL5TFWKbTMC8BGq%252Bm99WAaYWgnOmS6¬ify_time=2016-10-10+15%3A48%3A34¬ify_type=trade_status_sync&out_trade_no=test20161010092017&payment_type=1&seller_email=20718505%40qq.com&seller_id=2088421564177650&subject=111&total_fee=0.01&trade_no=2016101021001004470296721955&trade_status=TRADE_SUCCESS&sign=4d4f0c35e95f4dce7c34c1ff70e321fd&sign_type=MD5 if (Request.QueryString["trade_status"] == "TRADE_FINISHED" || Request.QueryString["trade_status"] == "TRADE_SUCCESS") { //判断该笔订单是否在商户网站中已经做过处理 VWPayOrderEntity payentity = PayOrderBLL.Instance.GetVWPayOrderByPayCode(out_trade_no); if (payentity.Id > 0 && payentity.Status == 0)//未支付完成 { PayAliResultEntity _entity = new PayAliResultEntity(); _entity.Buyeremail = buyer_email; _entity.Buyerid = buyer_id; _entity.CreateTime = DateTime.Now; _entity.HasDeal = 0; _entity.Issuccess = is_success; _entity.Notifytime = notify_time; _entity.Notifytype = notify_type; _entity.Outtradeno = out_trade_no; _entity.Paymenttype = payment_type; _entity.Selleremail = seller_email; _entity.Sellerid = seller_id; _entity.Subject = subject; _entity.Totalfee = total_fee; _entity.Tradeno = trade_no; _entity.Tradestatus = trade_status; LogUtil.Log("订单付款回调成功:", JsonJC.ObjectToJson(_entity)); PayAliResultBLL.Instance.AddPayAliResult(_entity); payentity.PayTime = DateTime.Now; payentity.PayPrice = StringUtils.GetDbDecimal(total_fee); payentity.ExternalCode = trade_no; payentity.Status = 1; //先更新业务网站收款记录 int result = PayOrderBLL.Instance.RecivedPaySuccess(payentity); if (payentity.SysType == (int)SystemType.B2B || payentity.SysType == (int)SystemType.B2BMobile) { VWOrderEntity _order = OrderBLL.Instance.GetVWOrderByCode(StringUtils.GetDbLong(payentity.SysOrderCode)); if (_order.Status == (int)OrderStatus.WaitPay) { if (OrderBLL.Instance.PayFinishedForOrder(StringUtils.GetDbLong(payentity.SysOrderCode), payentity.PayPrice) > 0) { ///业务网站状态更新后更新支付总表 EmailSendBLL.Instance.OrderRemind(out_trade_no); LogUtil.Log("订单付款成功,订单号:", out_trade_no.ToString()); } } } return(Redirect("/Pay/PaySuccess")); } else if (payentity.Id > 0 && payentity.Status == 1) { return(Redirect("/Pay/PaySuccess")); } else { return(Redirect("/Pay/PayError")); } //如果没有做过处理,根据订单号(out_trade_no)在商户网站的订单系统中查到该笔订单的详细,并执行商户的业务程序 //如果有做过处理,不执行商户的业务程序 } else { Response.Write("trade_status=" + Request.QueryString["trade_status"]); } Response.Write("支付成功<br />"); return(Redirect("/Pay/PayError")); //打印页面 //——请根据您的业务逻辑来编写程序(以上代码仅作参考)—— ///////////////////////////////////////////////////////////////////////////////////////////////////////////// } else//验证失败 { //string out_trade_no = Request.QueryString["out_trade_no"]; //VWOrderEntity _order = OrderBLL.Instance.GetVWOrderByCode(StringUtils.GetDbLong(out_trade_no)); //if (_order.Status == (int)OrderStatus.WaitDeal|| _order.Status == (int)OrderStatus.WaitDeliver) //{ // return Redirect("/Pay/PaySuccess"); //} Response.Write("支付验证失败"); } } else { Response.Write("无返回参数"); } return(View()); }
/// <summary> /// 收到支付回调修改状态 /// </summary> /// <param name="payOrder"></param> /// <returns></returns> public int RecivedPaySuccess(VWPayOrderEntity payOrder) { return(PayOrderDA.Instance.RecivedPaySuccess(payOrder)); }
public abstract void SendRequest(VWPayOrderEntity tradeEntity);