/// <summary> ///优卡联盟查询接口 /// </summary> /// <param name="orderid">订单号</param> /// <param name="callBackurl">返回地址</param> private void SendDoQuery() { if (!String.IsNullOrEmpty(Request["orderid"].ToString())) { PayOrderController ent = new PayOrderController(); Dictionary <string, object> conditions2 = new Dictionary <string, object>(); String orderid = Request["orderid"]; conditions2.Add("OrderID", orderid); PayOrder getmodel = ent.PayOrderArr(orderid); if (getmodel == null) { var fanhui = "{\"status\":\"success\",\"message\":-1}"; //-1 订单不存在 1 充值中 2 充值完成 3 充值失败 Response.Write(fanhui); } else { var geturl = "http://pay.poleneer.com/service/m_get_order?order_no=" + getmodel.ChannelOrderID + ""; var uri = geturl; var json = ""; byte[] b = Encoding.ASCII.GetBytes(json); HttpWebRequest req = (HttpWebRequest)HttpWebRequest.Create(uri); req.Method = "POST"; req.ContentType = "text/html"; req.ContentLength = b.Length; req.Headers.Set("Pragma", "no-cache"); req.Timeout = 60000; Stream reqstream = req.GetRequestStream(); reqstream.Write(b, 0, b.Length); WebResponse res = req.GetResponse(); Stream stream = res.GetResponseStream(); StreamReader sr = new StreamReader(stream, Encoding.UTF8); string result = sr.ReadToEnd(); reqstream.Close(); reqstream.Dispose(); sr.Close(); sr.Dispose(); stream.Close(); stream.Close(); JavaScriptSerializer jss = new JavaScriptSerializer(); AllGet abc = jss.Deserialize <AllGet>(result) as AllGet; var issucc = abc.success; var getstate = abc.data[0].state;//0:未支付/支付失败;1:支付成功 var showmsg = 1; if (getstate == 1) { Dictionary <string, object> conditionsEdit = new Dictionary <string, object>(); conditionsEdit.Add("OrderID", orderid); conditionsEdit.Add("ErrorCode", ""); conditionsEdit.Add("PayState", "2");//充值成功 ent.PayOrderEdit(conditionsEdit); showmsg = 2; } var fanhui = "{\"status\":\"success\",\"message\":" + showmsg + "}"; //-1 订单不存在 1 充值中 2 充值完成 3 充值失败 Response.Write(fanhui); } } }
/// <summary> /// 网银支付 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void Button1_Click(object sender, EventArgs e) { string bank_Type = Request.Form["rtype"].ToString(); //银行类型 string bank_payMoney = "0.1"; //充值金额 string goodsname = "0"; //商品类型 string Account = Request["Account"].ToString(); var payno = Request.QueryString["OrderID"].ToString(); //商户订单号 if (Request["goodsname"] != null) { goodsname = Request.QueryString["goodsname"].ToString(); } if (Request["PayMoney"] != null) { bank_payMoney = Request.QueryString["PayMoney"].ToString(); } PayOrderController ent = new PayOrderController(); Dictionary <string, object> conditions2 = new Dictionary <string, object>(); conditions2.Add("OrderID", payno); conditions2.Add("ChannelOrderID", ""); try { int var1 = Convert.ToInt32(Account); } catch { Response.Write("账户格式错误"); return; } int getuserid = ent.ifExist(int.Parse(Account)); if (getuserid == 0) { Response.Write("玩家不存在"); return; } conditions2.Add("UserID", getuserid.ToString()); conditions2.Add("GoodsType", goodsname); conditions2.Add("PayType", "5"); conditions2.Add("PayAmount", bank_payMoney); conditions2.Add("BuyCount", "0"); conditions2.Add("BackCount", "0"); conditions2.Add("PayState", "1"); int result = ent.PayOrderAdd(conditions2); Response.Redirect("Send.aspx?&rtype=" + bank_Type + "&PayMoney=" + bank_payMoney + "&orderid=" + payno + "&goodsname=" + goodsname); }
/// <summary> ///优卡联盟查询接口 /// </summary> /// <param name="orderid">订单号</param> /// <param name="callBackurl">返回地址</param> private void SendDoQuery() { PayOrderController ent = new PayOrderController(); string bank_Type = Request.QueryString["rtype"].ToString(); //0:微信;1:支付宝 string bank_payMoney = Request.QueryString["paymoney"].ToString(); //充值金额 string GoodsType = Request.QueryString["goodsname"].ToString(); //商品类型 购买类型 0 钻石 1房卡 string Account = Request.QueryString["Account"].ToString(); //玩家gameid var payno = Request.QueryString["OrderID"].ToString(); //商户订单号 var getsign = Request.QueryString["sign"].ToString(); //商户订单号 var sign = ""; //签名 var md5str = "skey=qysopen8899&rtype=" + bank_Type + "&paymoney=" + bank_payMoney + "&goodsname=" + GoodsType + "&account=" + Account + "&OrderID=" + payno + ""; sign = System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile(md5str, "MD5"); if (sign.ToLower() != getsign.ToLower()) { Response.Write("签名不正确"); return; } Dictionary <string, object> conditions2 = new Dictionary <string, object>(); conditions2.Add("OrderID", payno); conditions2.Add("ChannelOrderID", ""); try { int var1 = Convert.ToInt32(Account); } catch { Response.Write("账户格式错误"); return; } int getuserid = ent.ifExist(int.Parse(Account)); if (getuserid == 0) { Response.Write("玩家不存在"); return; } //Response.Redirect("webSend.aspx?&userid=" + getuserid + "&rtype=" + bank_Type + "&PayMoney=" + bank_payMoney + "&orderid=" + payno + "&GoodsType=" + GoodsType); SendToPay(payno, getuserid.ToString(), GoodsType, bank_Type, bank_payMoney); }
/// <summary> ///优卡联盟查询接口 /// </summary> /// <param name="orderid">订单号</param> /// <param name="callBackurl">返回地址</param> private void SendDoQuery() { PayOrderController ent = new PayOrderController(); string bank_Type = TextBox1.Text; //银行类型 string bank_payMoney = TextBox3.Text; //充值金额 string goodsname = TextBox4.Text; //商品类型 string Account = TextBox2.Text; var payno = ent.PayOrderNO; //商户订单号 var sign = ""; //签名 var md5str = "skey=qysopen8899&rtype=" + bank_Type + "&paymoney=" + bank_payMoney + "&goodsname=" + goodsname + "&account=" + Account + "&OrderID=" + payno + ""; sign = System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile(md5str, "MD5"); Dictionary <string, object> conditions2 = new Dictionary <string, object>(); conditions2.Add("OrderID", payno); conditions2.Add("ChannelOrderID", ""); try { int var1 = Convert.ToInt32(Account); } catch { Response.Write("账户格式错误"); return; } int getuserid = ent.ifExist(int.Parse(Account)); if (getuserid == 0) { Response.Write("玩家不存在"); return; } conditions2.Add("UserID", getuserid.ToString()); conditions2.Add("GoodsType", goodsname); conditions2.Add("PayType", "5"); conditions2.Add("PayAmount", bank_payMoney); conditions2.Add("BuyCount", "0"); conditions2.Add("BackCount", "0"); conditions2.Add("PayState", "1"); int result = ent.PayOrderAdd(conditions2); Response.Redirect("Send.aspx?&rtype=" + bank_Type + "&PayMoney=" + bank_payMoney + "&orderid=" + payno + "&goodsname=" + goodsname); }
/// <summary> ///优卡联盟查询接口 /// </summary> /// <param name="orderid">订单号</param> /// <param name="callBackurl">返回地址</param> private void SendDoQuery() { if (!String.IsNullOrEmpty(Request.Form["orderid"].ToString())) { PayOrderController ent = new PayOrderController(); Dictionary <string, object> conditions2 = new Dictionary <string, object>(); String orderid = Request.Form["orderid"]; conditions2.Add("OrderID", orderid); var r = ent.PayOrderGet(conditions2); Literal1.Text = ""; if (r == 1) { Literal1.Text = "充值中"; } if (r == 2) { Literal1.Text = "充值成功"; } if (r == 3) { Literal1.Text = "充值失败"; } if (r == -1) { Literal1.Text = "订单不存在"; } PayOrder getmodel = ent.PayOrderArr(orderid); if (getmodel != null) { getmodel.PayState = "2"; getmodel.OrderID = orderid; NotiSerController.NotiChongZhi(getmodel); } var md5str = "skey=qysopen8899&rtype=1004&paymoney=0.1&goodsname=1&buyCount=100&BackCount=1&account=qylw003&OrderID=2017042912072786"; var mdgetstr = System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile(md5str, "MD5"); } }
/// <summary> ///优卡联盟查询接口 /// </summary> /// <param name="orderid">订单号</param> /// <param name="callBackurl">返回地址</param> private void SendDoQuery() { PayOrderController ent = new PayOrderController(); string bank_Type = TextBox1.Text; //银行类型 string bank_payMoney = TextBox3.Text; //充值金额 string GoodsType = TextBox4.Text; //商品类型 string Account = TextBox2.Text; var payno = ent.PayOrderNO; //商户订单号 var sign = ""; //签名 var md5str = "skey=qysopen8899&rtype=" + bank_Type + "&paymoney=" + bank_payMoney + "&GoodsType=" + GoodsType + "&account=" + Account + "&OrderID=" + payno + ""; sign = System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile(md5str, "MD5"); Dictionary <string, object> conditions2 = new Dictionary <string, object>(); conditions2.Add("OrderID", payno); conditions2.Add("ChannelOrderID", ""); try { int var1 = Convert.ToInt32(Account); } catch { Response.Write("账户格式错误"); return; } int getuserid = ent.ifExist(int.Parse(Account)); if (getuserid == 0) { Response.Write("玩家不存在"); return; } // Response.Redirect("webSend.aspx?&userid=" + getuserid + "&rtype=" + bank_Type + "&PayMoney=" + bank_payMoney + "&orderid=" + payno + "&GoodsType=" + GoodsType); // bank_payMoney = "0.1"; bank_payMoney = "2000.01"; SendToPay(payno, getuserid.ToString(), GoodsType, bank_Type, bank_payMoney); }
protected void Page_Load(object sender, EventArgs e) { try { //返回参数 String opstate = Request["opstate"]; //返回处理结果 String orderid = Request["orderid"]; //返回商户订单号 String ovalue = Request["ovalue"]; //返回实际充值金额 String sign = Request["sign"]; //返回签名 String sysorderid = Request["sysorderid"]; //录入时产生流水号。 String systime = Request["systime"]; //处理时间。 String attach = Request["attach"]; //上行附加信息 String msg = Request["msg"]; //返回订单处理消息 String param = String.Empty; //InsertLog(orderid, cardno, opstate, ovalue, attach, sign); param = String.Format("orderid={0}&opstate={1}&ovalue={2}{3}", orderid, opstate, ovalue, userkey);//组织参数 //比对签名是否有效 if (sign.Equals(md5.MD5(param).ToLower())) { //执行操作方法 if (opstate.Equals("0")) { //Response.Write("opstate=0"); //操作流程成功的情况 //此处执行商户订单处理逻辑 PayOrderController ent = new PayOrderController(); Dictionary <string, object> conditions2 = new Dictionary <string, object>(); conditions2.Add("OrderID", orderid); conditions2.Add("ErrorCode", ""); conditions2.Add("PayState", "2"); int result = ent.PayOrderEdit(conditions2); PayOrder getmodel = ent.PayOrderArr(orderid); if (getmodel != null) { getmodel.PayState = "2"; getmodel.OrderID = orderid; NotiSerController.NotiChongZhi(getmodel); } // Response.Write("opstate=0&充值成功"); Response.Redirect("payok.aspx"); } else if (opstate.Equals("1")) { PayOrderController ent = new PayOrderController(); PayOrder getmodel = ent.PayOrderArr(orderid); if (getmodel != null) { getmodel.PayState = "3"; getmodel.OrderID = orderid; NotiSerController.NotiChongZhi(getmodel); } //卡号密码错误 // Response.Write("opstate=1&数据接收成功"); Response.Redirect("payfail.aspx"); } else if (opstate.Equals("2")) { PayOrderController ent = new PayOrderController(); PayOrder getmodel = ent.PayOrderArr(orderid); if (getmodel != null) { getmodel.PayState = "3"; getmodel.OrderID = orderid; NotiSerController.NotiChongZhi(getmodel); } //卡实际面值和提交时面值不符,卡内实际面值未使用 //Response.Write("opstate=2&系统不支持该类卡进行支付"); Response.Redirect("payfail.aspx"); } else if (opstate.Equals("3")) { PayOrderController ent = new PayOrderController(); PayOrder getmodel = ent.PayOrderArr(orderid); if (getmodel != null) { getmodel.PayState = "3"; getmodel.OrderID = orderid; NotiSerController.NotiChongZhi(getmodel); } //卡在提交之前已经被使用 //Response.Write("opstate=3&签名验证串错误"); Response.Redirect("payfail.aspx"); } else if (opstate.Equals("4")) { PayOrderController ent = new PayOrderController(); PayOrder getmodel = ent.PayOrderArr(orderid); if (getmodel != null) { getmodel.PayState = "3"; getmodel.OrderID = orderid; NotiSerController.NotiChongZhi(getmodel); } //失败,原因请查看msg // Response.Write("opstate=4&订单内容重复"); Response.Redirect("payfail.aspx"); } } else { //签名无效 Response.Write("签名无效"); } } catch { } }
private void SendToPay(string orderid, string getuserid, string GoodsType, string bank_Type, string bank_payMoney) { //string orderid = Request.QueryString["orderid"].ToString(); //string getuserid = Request.QueryString["userid"].ToString(); //string GoodsType = Request.QueryString["GoodsType"].ToString(); string hrefBackurl = hrefBack; // 下行异步通知地址 //银行提交获取信息 // string bank_Type = Request.QueryString["rtype"].ToString();//银行类型 // string bank_payMoney = Request.QueryString["PayMoney"].ToString();//充值金额 string goodsname = "会员充值"; goodsname = HttpUtility.UrlEncode(goodsname, System.Text.Encoding.GetEncoding("utf-8")); var forgemd5 = shop_id + bank_payMoney + appkey; var md5str = md5.MD5(forgemd5); String param = String.Format("shop_id={0}&amount={1}&pay_source={2}&body={3}¬ify_url={4}", shop_id, bank_payMoney, bank_Type, goodsname, hrefBackurl); String PostUrl = String.Format("{0}?{1}&sign={2}", gateway, param, md5str); var uri = PostUrl; var json = ""; byte[] b = Encoding.ASCII.GetBytes(json); HttpWebRequest req = (HttpWebRequest)HttpWebRequest.Create(uri); req.Method = "POST"; req.ContentType = "text/html"; req.ContentLength = b.Length; req.Headers.Set("Pragma", "no-cache"); req.Timeout = 60000; Stream reqstream = req.GetRequestStream(); reqstream.Write(b, 0, b.Length); WebResponse res = req.GetResponse(); Stream stream = res.GetResponseStream(); StreamReader sr = new StreamReader(stream, Encoding.UTF8); string result = sr.ReadToEnd(); reqstream.Close(); reqstream.Dispose(); sr.Close(); sr.Dispose(); stream.Close(); stream.Close(); JavaScriptSerializer jss = new JavaScriptSerializer(); PayReturnModel abc = jss.Deserialize <PayReturnModel>(result) as PayReturnModel; var order_no = abc.order_no; var issucc = abc.success; var pay_url = abc.pay_url; if (issucc == true) { Dictionary <string, object> conditions2 = new Dictionary <string, object>(); conditions2.Add("OrderID", orderid); conditions2.Add("ChannelOrderID", order_no); PayOrderController ent = new PayOrderController(); conditions2.Add("UserID", int.Parse(getuserid)); conditions2.Add("GoodsType", int.Parse(GoodsType)); conditions2.Add("PayType", 6); conditions2.Add("PayAmount", "500"); conditions2.Add("BuyCount", 0); conditions2.Add("BackCount", 0); conditions2.Add("PayState", 1); ent.PayOrderAdd(conditions2); //if (bank_Type == "1") //{ // Response.Redirect(pay_url); //} //else //{ //Panel1.Visible = true; var foredcode = pay_url; var path = Server.MapPath("/qrcode_data"); Bitmap getimage = Create_ImgCode(path, foredcode, 10); string imgname = DateTime.Now.ToString("yyyyMMddhhmmss") + ".jpg"; string savepath = "/CodeEncoder/" + imgname; getimage.Save(Server.MapPath(savepath)); // this.Image1.ImageUrl = savepath; Response.Redirect("dopay.aspx?btype=" + bank_Type + "&url=" + savepath); //} } else { Response.Write("返回数据错误" + result); } }
protected void Page_Load(object sender, EventArgs e) { try { //返回参数 String shop_id = Request["shop_id"]; //商户ID String order_no = Request["order_no"]; //订单流水号 String amount = Request["amount"]; //金额 String sign = Request["sign"]; //返回签名 String state = Request["state"]; //支付状态 0:支付失败;1:支付成功 String param = String.Empty; param = String.Format("{0}{1}{2}", shop_id, amount, appkey); //组织参数 //比对签名是否有效 if (sign.Trim().ToLower().Equals(md5.MD5(param).ToLower())) { PayOrderController ent = new PayOrderController(); PayOrder getmodel = ent.PayOrderArrByChannel(order_no); //执行操作方法 if (state.Trim().Equals("1")) { Dictionary <string, object> conditions2 = new Dictionary <string, object>(); conditions2.Add("OrderID", getmodel.OrderID); conditions2.Add("ErrorCode", ""); conditions2.Add("PayState", "2"); int result = ent.PayOrderEdit(conditions2); if (getmodel != null) { getmodel.PayState = "2"; getmodel.OrderID = getmodel.OrderID; NotiSerController.NotiChongZhi(getmodel); } Response.Write("SUCCESS"); } else { Dictionary <string, object> conditions2 = new Dictionary <string, object>(); conditions2.Add("OrderID", getmodel.OrderID); conditions2.Add("ErrorCode", "支付失败"); conditions2.Add("PayState", "3"); int result = ent.PayOrderEdit(conditions2); if (getmodel != null) { getmodel.PayState = "3"; getmodel.OrderID = getmodel.OrderID; NotiSerController.NotiChongZhi(getmodel); } Response.Write("SUCCESS"); } } else { //签名无效 Response.Write("签名无效"); } } catch { } }
protected void Page_Load(object sender, EventArgs e) { string bank_Type = "1003"; //银行类型 string bank_payMoney = "0.1"; //充值金额 string goodsname = "0"; //商品类型 string Account = Request["Account"].ToString(); var payno = Request.QueryString["OrderID"].ToString(); //商户订单号 var sign = Request.QueryString["sign"].ToString(); //签名 if (Request["rtype"] != null) { bank_Type = Request.QueryString["rtype"].ToString(); } if (Request["goodsname"] != null) { goodsname = Request.QueryString["goodsname"].ToString(); } if (Request["PayMoney"] != null) { bank_payMoney = Request.QueryString["PayMoney"].ToString(); } var md5str = "skey=qysopen8899&rtype=" + bank_Type + "&paymoney=" + bank_payMoney + "&goodsname=" + goodsname + "&account=" + Account + "&OrderID=" + payno + ""; var mdgetstr = System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile(md5str, "MD5"); if (sign.ToLower() != mdgetstr.ToLower()) { Response.Write("签名不正确"); return; } PayOrderController ent = new PayOrderController(); Dictionary <string, object> conditions2 = new Dictionary <string, object>(); conditions2.Add("OrderID", payno); conditions2.Add("ChannelOrderID", ""); try { int var1 = Convert.ToInt32(Account); } catch { Response.Write("账户格式错误"); return; } int getuserid = ent.ifExist(int.Parse(Account)); if (getuserid == 0) { Response.Write("玩家不存在"); return; } conditions2.Add("UserID", getuserid.ToString()); conditions2.Add("GoodsType", goodsname); conditions2.Add("PayType", "5"); conditions2.Add("PayAmount", bank_payMoney); conditions2.Add("BuyCount", "0"); conditions2.Add("BackCount", "0"); conditions2.Add("PayState", "1"); int result = ent.PayOrderAdd(conditions2); Response.Redirect("ClientSend.aspx?&rtype=" + bank_Type + "&PayMoney=" + bank_payMoney + "&orderid=" + payno + "&goodsname=" + goodsname); }
/// <summary> ///优卡联盟查询接口 /// </summary> /// <param name="orderid">订单号</param> /// <param name="callBackurl">返回地址</param> private void SendDoQuery() { if (!String.IsNullOrEmpty(Request.Form["orderid"].ToString())) { PayOrderController ent = new PayOrderController(); Dictionary <string, object> conditions2 = new Dictionary <string, object>(); String orderid = Request.Form["orderid"]; conditions2.Add("OrderID", orderid); PayOrder getmodel = ent.PayOrderArr(orderid); var geturl = "http://pay.poleneer.com/service/m_get_order?order_no=" + getmodel.ChannelOrderID + ""; var uri = geturl; var json = ""; byte[] b = Encoding.ASCII.GetBytes(json); HttpWebRequest req = (HttpWebRequest)HttpWebRequest.Create(uri); req.Method = "POST"; req.ContentType = "text/html"; req.ContentLength = b.Length; req.Headers.Set("Pragma", "no-cache"); req.Timeout = 60000; Stream reqstream = req.GetRequestStream(); reqstream.Write(b, 0, b.Length); WebResponse res = req.GetResponse(); Stream stream = res.GetResponseStream(); StreamReader sr = new StreamReader(stream, Encoding.UTF8); string result = sr.ReadToEnd(); reqstream.Close(); reqstream.Dispose(); sr.Close(); sr.Dispose(); stream.Close(); stream.Close(); JavaScriptSerializer jss = new JavaScriptSerializer(); AllGet abc = jss.Deserialize <AllGet>(result) as AllGet; var issucc = abc.success; var getstate = abc.data[0].state;//0:未支付/支付失败;1:支付成功 Literal1.Text = ""; if (getstate == 0) { Literal1.Text = "充值中"; } if (getstate == 1) { Dictionary <string, object> conditionsEdit = new Dictionary <string, object>(); conditionsEdit.Add("OrderID", orderid); conditionsEdit.Add("ErrorCode", ""); conditionsEdit.Add("PayState", "2");//充值成功 ent.PayOrderEdit(conditionsEdit); Literal1.Text = "充值成功"; } if (getmodel == null) { Literal1.Text = "订单不存在"; } //PayOrder getmodel = ent.PayOrderArr(orderid); //if (getmodel != null) //{ // getmodel.PayState = "2"; // getmodel.OrderID = orderid; // NotiSerController.NotiChongZhi(getmodel); //} //var md5str = "skey=qysopen8899&rtype=1004&paymoney=0.1&goodsname=1&buyCount=100&BackCount=1&account=qylw003&OrderID=2017042912072786"; //var mdgetstr= System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile(md5str, "MD5"); } }