protected void Page_Load(object sender, EventArgs e) { key = so["OnlinePay_007Ka_Key"].ToString(""); try { SettingParams(); } catch { errorMessage = "007订单查询结果:回调参数有误!"; new Log("OnlinePay").Write(errorMessage); Shove._Web.JavaScript.Alert(this.Page, errorMessage); return; } try { if (Request.QueryString.AllKeys.Length < 1) { errorMessage = OrderID+"订单查询结果:该数据传输丢失!"; new Log("OnlinePay").Write(errorMessage); Shove._Web.JavaScript.Alert(this.Page, errorMessage); return; } if (SignCounterpart != GetMD5(Orderinfo + "|" + key)) { errorMessage = OrderID + "订单查询结果:认证签名失败!"; new Log("OnlinePay").Write(errorMessage); Shove._Web.JavaScript.Alert(this.Page, errorMessage); return; } if (TranStat.ToString().Trim() != "1" && TranStat.ToString().Trim() != "29") { errorMessage = OrderID + "订单查询结果:007手机卡充值失败!错误号:" + TranStat.ToString() + " 错误描述:" + TranInfo + "(" + GetTranStatToStringCH(Shove._Convert.StrToInt(TranStat.ToString(),0)) + ")"; new Log("OnlinePay").Write(errorMessage); Shove._Web.JavaScript.Alert(this.Page, errorMessage); return; } DataTable dt = new DAL.Tables.T_UserPayDetails().Open("Result,UserID", "ID=" + OrderID, ""); if (dt == null || dt.Rows.Count < 1) { errorMessage = OrderID+"订单查询结果:支付号不存在,数据可能已近丢失!"; new Log("OnlinePay").Write(errorMessage); Shove._Web.JavaScript.Alert(this.Page, errorMessage); return; } else { if (Shove._Convert.StrToInt(dt.Rows[0][1].ToString(), 0) != 0) { if (Shove._Convert.StrToInt(dt.Rows[0][0].ToString(), 0) == 1) { errorMessage = OrderID + "订单充值已经成功!"; Response.Write("OK"); new Log("OnlinePay").Write(errorMessage); Shove._Web.JavaScript.Alert(this.Page, errorMessage); return; } int returnValue = -20000; string returnDescription = ""; double FormalitiesFeesScale = so["OnlinePay_007Ka_FormalitiesFees"].ToDouble(0) / 100; double FormalitiesFees = Math.Round((Shove._Convert.StrToDouble(Value, 0) / 100) * FormalitiesFeesScale, 2); long userid = Shove._Convert.StrToLong(dt.Rows[0][1].ToString(), 0); DAL.Procedures.P_UserAddMoney(1, userid, Shove._Convert.StrToDouble(Value, 0) / 100.00 - FormalitiesFees, FormalitiesFees, OrderID, "007KA", "007KA系统交易号" + OrderID, ref returnValue, ref returnDescription); if (returnValue < 0) { errorMessage = OrderID+"订单查询结果:增加电子货币错误。错误原因:" + returnDescription; new Log("OnlinePay").Write(errorMessage); Shove._Web.JavaScript.Alert(this.Page, errorMessage); return; } else { errorMessage = OrderID+"订单充值成功!"; Response.Write("OK"); new Log("OnlinePay").Write(errorMessage); Shove._Web.JavaScript.Alert(this.Page, errorMessage); return; } } else { errorMessage = OrderID+"订单查询结果:充值未完成!错误原因:用户不存在"; new Log("OnlinePay").Write(errorMessage); Shove._Web.JavaScript.Alert(this.Page, errorMessage); return; } } } catch { errorMessage = OrderID+"订单查询结果:错误描述:出现未知异常!"; new Log("OnlinePay").Write(errorMessage); Shove._Web.JavaScript.Alert(this.Page, errorMessage); return; } }
//功能函数。将字符串进行编码格式转换,并进行MD5加密,然后返回。结束 //============================================================================== private bool WriteUserAccount(Users thisUser, string PayNumber, double PayMoney, string Memo) { if (PayMoney <= 0) { return false; } double formalitiesFeesScale = so["OnlinePay_99Bill_PayFormalitiesFeesScale"].ToDouble(0) / 100; double formalitiesFees = PayMoney - Math.Round(PayMoney / (formalitiesFeesScale + 1), 2); double addMoney = PayMoney - formalitiesFees; string ReturnDescription = ""; bool ok = (thisUser.AddUserBalance(addMoney, formalitiesFees, PayNumber,"快钱", Memo, ref ReturnDescription) == 0); //new Log("OnlinePay").Write("ReturnDescription:" + ReturnDescription); if (!ok) { DataTable dt = new DAL.Tables.T_UserPayDetails().Open("Result", "[id] = " + Shove._Convert.StrToLong(PayNumber, 0).ToString(), ""); if (dt == null || dt.Rows.Count == 0) { new Log("OnlinePay").Write("[快钱]在线支付:返回的交易号找不到对应的数据"); return false; } int IsOK = Shove._Convert.StrToInt(dt.Rows[0][0].ToString(), 0); if (IsOK == 1) { return true; } else { new Log("OnlinePay").Write("[快钱]在线支付:对应的数据未处理"); return false; } } return ok; }
protected void Page_Load(object sender, EventArgs e) { try { this.SettingParams(); } catch (Exception exception) { this.errorMessage = "通知错误:错误错误描述:007Ka回调页面参数列表!"; new Log("OnlinePay").Write(this.errorMessage + " 错误信息:" + exception.Message); base.Response.End(); return; } base.Response.Write("OK"); this.key = this.so["OnlinePay_007Ka_Key"].ToString("").Trim(); if (!(this.Sign != this.GetMD5(this.Orderinfo))) { if (this.MerID != this.so["OnlinePay_007Ka_MerchantId"].ToString("").Trim()) { this.errorMessage = "通知错误:充值未完成。错误描述:商户号错误,数据非法!"; new Log("OnlinePay").Write(this.errorMessage); base.Response.End(); } else if (this.MerAccount != this.so["OnlinePay_007Ka_MerAccount"].ToString("").Trim()) { this.errorMessage = "通知错误:充值未完成。错误描述:银行账号错误,数据非法!"; new Log("OnlinePay").Write(this.errorMessage); base.Response.End(); } else if ((this.TranStat.ToString().Trim() != "1") && (this.TranStat.ToString().Trim() != "29")) { this.errorMessage = "通知错误:充值未完成。错误号:" + this.TranStat + "错误描述:" + this.TranInfo; new Log("OnlinePay").Write(this.errorMessage); base.Response.End(); } else { DataTable table = new Tables.T_UserPayDetails().Open("Result,UserID", "ID=" + this.OrderID, ""); if ((table == null) || (table.Rows.Count < 1)) { this.errorMessage = "通知错误:充值未完成。错误描述:数据库错误。关联错误:获取支付流水号未成功。"; new Log("OnlinePay").Write(this.errorMessage); base.Response.End(); } else if (_Convert.StrToLong(table.Rows[0][0].ToString(), 0L) == 0L) { string returnDescription = ""; int returnValue = 1; double num2 = this.so["OnlinePay_007Ka_FormalitiesFees"].ToDouble(0.0) / 100.0; double formalitiesFees = Math.Round((double)((_Convert.StrToDouble(this.Value, 0.0) / 100.0) * num2), 2); Procedures.P_UserAddMoney(1L, _Convert.StrToLong(table.Rows[0][1].ToString(), 0L), (_Convert.StrToDouble(this.Value, 0.0) / 100.0) - formalitiesFees, formalitiesFees, this.OrderID, "007Ka", "系统交易号:" + this.OrderID + "007Ka支付", ref returnValue, ref returnDescription); if (returnValue < 0) { this.errorMessage = "通知错误:充值未完成。错误描述:增加电子货币错误。错误原因:" + returnDescription; new Log("OnlinePay").Write(this.errorMessage); base.Response.End(); } else { this.errorMessage = "007在线充值:充值完成"; new Log("OnlinePay").Write(this.errorMessage); base.Response.End(); } } else { this.errorMessage = "007在线充值:充值完成"; new Log("OnlinePay").Write(this.errorMessage); base.Response.End(); } } } else { this.errorMessage = "通知错误:充值未完成。错误描述:认证签名失败!"; new Log("OnlinePay").Write(this.errorMessage); base.Response.End(); } }
protected void Page_Load(object sender, EventArgs e) { this.key = this.so["OnlinePay_007Ka_Key"].ToString(""); try { this.SettingParams(); } catch { this.errorMessage = "007订单查询结果:回调参数有误!"; new Log("OnlinePay").Write(this.errorMessage); JavaScript.Alert(this.Page, this.errorMessage); return; } try { if (base.Request.QueryString.AllKeys.Length < 1) { this.errorMessage = this.OrderID + "订单查询结果:该数据传输丢失!"; new Log("OnlinePay").Write(this.errorMessage); JavaScript.Alert(this.Page, this.errorMessage); } else if (this.SignCounterpart != this.GetMD5(this.Orderinfo + "|" + this.key)) { this.errorMessage = this.OrderID + "订单查询结果:认证签名失败!"; new Log("OnlinePay").Write(this.errorMessage); JavaScript.Alert(this.Page, this.errorMessage); } else if ((this.TranStat.ToString().Trim() != "1") && (this.TranStat.ToString().Trim() != "29")) { this.errorMessage = this.OrderID + "订单查询结果:007手机卡充值失败!错误号:" + this.TranStat.ToString() + " 错误描述:" + this.TranInfo + "(" + this.GetTranStatToStringCH(_Convert.StrToInt(this.TranStat.ToString(), 0)) + ")"; new Log("OnlinePay").Write(this.errorMessage); JavaScript.Alert(this.Page, this.errorMessage); } else { DataTable table = new Tables.T_UserPayDetails().Open("Result,UserID", "ID=" + this.OrderID, ""); if ((table == null) || (table.Rows.Count < 1)) { this.errorMessage = this.OrderID + "订单查询结果:支付号不存在,数据可能已近丢失!"; new Log("OnlinePay").Write(this.errorMessage); JavaScript.Alert(this.Page, this.errorMessage); } else if (_Convert.StrToInt(table.Rows[0][1].ToString(), 0) != 0) { if (_Convert.StrToInt(table.Rows[0][0].ToString(), 0) == 1) { this.errorMessage = this.OrderID + "订单充值已经成功!"; base.Response.Write("OK"); new Log("OnlinePay").Write(this.errorMessage); JavaScript.Alert(this.Page, this.errorMessage); } else { int returnValue = -20000; string returnDescription = ""; double num2 = this.so["OnlinePay_007Ka_FormalitiesFees"].ToDouble(0.0) / 100.0; double formalitiesFees = Math.Round((double)((_Convert.StrToDouble(this.Value, 0.0) / 100.0) * num2), 2); long userID = _Convert.StrToLong(table.Rows[0][1].ToString(), 0L); Procedures.P_UserAddMoney(1L, userID, (_Convert.StrToDouble(this.Value, 0.0) / 100.0) - formalitiesFees, formalitiesFees, this.OrderID, "007KA", "007KA系统交易号" + this.OrderID, ref returnValue, ref returnDescription); if (returnValue < 0) { this.errorMessage = this.OrderID + "订单查询结果:增加电子货币错误。错误原因:" + returnDescription; new Log("OnlinePay").Write(this.errorMessage); JavaScript.Alert(this.Page, this.errorMessage); } else { this.errorMessage = this.OrderID + "订单充值成功!"; base.Response.Write("OK"); new Log("OnlinePay").Write(this.errorMessage); JavaScript.Alert(this.Page, this.errorMessage); } } } else { this.errorMessage = this.OrderID + "订单查询结果:充值未完成!错误原因:用户不存在"; new Log("OnlinePay").Write(this.errorMessage); JavaScript.Alert(this.Page, this.errorMessage); } } } catch { this.errorMessage = this.OrderID + "订单查询结果:错误描述:出现未知异常!"; new Log("OnlinePay").Write(this.errorMessage); JavaScript.Alert(this.Page, this.errorMessage); } }
private bool WriteUserAccount(Users _User, string orderid, string amount, string Memo) { double money = _Convert.StrToDouble(amount, 0.0); if (money != 0.0) { double num2 = this.so["OnlinePay_Alipay_PayFormalitiesFeesScale"].ToDouble(0.0) / 100.0; double formalitiesFees = money - Math.Round((double)(money / (num2 + 1.0)), 2); money -= formalitiesFees; string returnDescription = ""; bool flag = _User.AddUserBalance(money, formalitiesFees, orderid, "支付宝支付," + this.so["OnlinePay_Alipay_UserName"].ToString(""), Memo, ref returnDescription) == 0; if (flag) { return flag; } DataTable table = new Tables.T_UserPayDetails().Open("Result", "[id] = " + _Convert.StrToLong(orderid, 0L).ToString(), ""); if ((table == null) || (table.Rows.Count == 0)) { new Log("System").Write("在线支付:返回的交易号找不到对应的数据"); return false; } if (_Convert.StrToInt(table.Rows[0][0].ToString(), 0) == 1) { return true; } new Log("System").Write("在线支付:对应的数据未处理"); } return false; }
private bool WriteUserAccount(string Memo) { if (Money == 0) { return false; } double FormalitiesFeesScale = so["OnlinePay_ChinaUnion_CommissionScale"].ToDouble(0) / 100; double FormalitiesFees = Money - Math.Round(Money / (FormalitiesFeesScale + 1), 2); Money -= FormalitiesFees; string ReturnDescription = ""; bool ok = (_User.AddUserBalance(Money, FormalitiesFees, sp_billno, getBankName(bankPay), Memo, ref ReturnDescription) == 0); if (!ok) { DataTable dt = new DAL.Tables.T_UserPayDetails().Open("Result", "[id] = " + Shove._Convert.StrToLong(sp_billno, 0).ToString(), ""); if (dt == null || dt.Rows.Count == 0) { //new Log("System").Write("在线支付:返回的交易号找不到对应的数据"); return false; } int IsOK = Shove._Convert.StrToInt(dt.Rows[0][0].ToString(), 0); if (IsOK == 1) { return true; } else { //new Log("System").Write("在线支付:对应的数据未处理"); return false; } } return ok; }
private void Page_Load(object sender, System.EventArgs e) { string errmsg = ""; //卖家商户key key = so["OnlinePay_Tenpay_MD5Key"].Value.ToString(); //卖家商户号 bargainor_id = so["OnlinePay_Tenpay_UserNumber"].Value.ToString(); if (GetQueryValueFromUrl(Request.QueryString, out errmsg)) { if (pay_result == PAYOK) { //如果充值查询成功,那么去对记录进行处理 try { string Memo = "系统交易号:" + sp_billno + ",财付通交易号:" + transaction_id; int ReturnValue = -1; string ReturnDescription = ""; int Results = -1; DAL.Tables.T_UserPayDetails t_paydetails = new DAL.Tables.T_UserPayDetails(); DataTable tmptTB = t_paydetails.Open("", "ID=" + sp_billno, ""); if (tmptTB == null || tmptTB.Rows.Count <= 0) { Response.Write("<script type=\"text/javascript\">alert(\"支付号为 " + sp_billno + " 的支付记录没有充值成功,描述:充值处理失败,本条数据丢失。\");</script>"); return; } double Money = Shove._Convert.StrToDouble(tmptTB.Rows[0]["Money"].ToString(), 0); long ID = Shove._Convert.StrToLong(tmptTB.Rows[0]["UserID"].ToString(), 0); double FormalitiesFees = Shove._Convert.StrToDouble(tmptTB.Rows[0]["FormalitiesFees"].ToString(), 0); string[] banks = tmptTB.Rows[0]["PayType"].ToString().Split('_'); string PayBank = banks.Length < 2 ? "" : banks[1]; Results = DAL.Procedures.P_UserAddMoney(_Site.ID, ID, Money, FormalitiesFees, sp_billno,getBankName(PayBank), Memo, ref ReturnValue, ref ReturnDescription); if (Results < 0) { Response.Write("<script type=\"text/javascript\">alert(\"支付号为 " + sp_billno + " 的支付记录没有充值成功,描述:数据库读写错误\");</script>"); return; } else { if (ReturnValue < 0) { Response.Write("<script type=\"text/javascript\">alert(\"" + ReturnDescription + "\");</script>"); return; } Response.Write("<script type=\"text/javascript\">alert(\"此笔充值记录已到帐并已处理成功!\");</script>"); } } catch { Response.Write("<script type=\"text/javascript\">alert(\"支付号为 " + sp_billno + " 的支付记录没有充值成功,描述:查询失败,可能是网络通讯故障。请重试一次。\");</script>"); return; } } else { Response.Write("<script type=\"text/javascript\">alert(\"支付号为 " + sp_billno + " 的支付记录没有充值成功,描述:" + payerrmsg+"\");</script>"); } } else { //认证签名失败 errmsg = "认证签名失败"; Response.Write("<script type=\"text/javascript\">alert(\"支付号为 " + sp_billno + " 的支付记录没有充值成功,描述:" + errmsg + "\");</script>"); } }
protected void Page_Load(object sender, EventArgs e) { try { SettingParams(); } catch (Exception ee) { errorMessage = "通知错误:错误错误描述:007Ka回调页面参数列表!"; new Log("OnlinePay").Write(errorMessage + " 错误信息:" + ee.Message); Response.End(); return; } Response.Write("OK"); key = so["OnlinePay_007Ka_Key"].ToString("").Trim(); if (Sign != GetMD5(Orderinfo)) { errorMessage = "通知错误:充值未完成。错误描述:认证签名失败!"; new Log("OnlinePay").Write(errorMessage); Response.End(); return; } if (MerID != so["OnlinePay_007Ka_MerchantId"].ToString("").Trim()) { errorMessage = "通知错误:充值未完成。错误描述:商户号错误,数据非法!"; new Log("OnlinePay").Write(errorMessage); Response.End(); return; } if (MerAccount != so["OnlinePay_007Ka_MerAccount"].ToString("").Trim()) { errorMessage = "通知错误:充值未完成。错误描述:银行账号错误,数据非法!"; new Log("OnlinePay").Write(errorMessage); Response.End(); return; } if (TranStat.ToString().Trim() != "1" && TranStat.ToString().Trim() != "29") { errorMessage = "通知错误:充值未完成。错误号:"+TranStat+"错误描述:"+TranInfo; new Log("OnlinePay").Write(errorMessage); Response.End(); return; } DataTable dt = new DAL.Tables.T_UserPayDetails().Open("Result,UserID", "ID=" + OrderID, ""); if (dt == null || dt.Rows.Count < 1) { errorMessage = "通知错误:充值未完成。错误描述:数据库错误。关联错误:获取支付流水号未成功。"; new Log("OnlinePay").Write(errorMessage); Response.End(); return; } else { if (Shove._Convert.StrToLong(dt.Rows[0][0].ToString(), 0) == 0) { string returnDescription = ""; int returnValue = 1; double FormalitiesFeesScale = so["OnlinePay_007Ka_FormalitiesFees"].ToDouble(0) / 100; double FormalitiesFees = Math.Round((Shove._Convert.StrToDouble(Value, 0) / 100) * FormalitiesFeesScale, 2); DAL.Procedures.P_UserAddMoney(1, Shove._Convert.StrToLong(dt.Rows[0][1].ToString(), 0), Shove._Convert.StrToDouble(Value, 0) / 100.00 - FormalitiesFees, FormalitiesFees, OrderID, "007Ka", "系统交易号:" + OrderID + "007Ka支付", ref returnValue, ref returnDescription); if (returnValue < 0) { errorMessage = "通知错误:充值未完成。错误描述:增加电子货币错误。错误原因:" + returnDescription; new Log("OnlinePay").Write(errorMessage); Response.End(); return; } else { errorMessage = "007在线充值:充值完成"; new Log("OnlinePay").Write(errorMessage); Response.End(); return; } } else { errorMessage = "007在线充值:充值完成"; new Log("OnlinePay").Write(errorMessage); Response.End(); return; } } }
private void Page_Load(object sender, EventArgs e) { string errmsg = ""; this.key = this.so["OnlinePay_Tenpay_MD5Key"].Value.ToString(); this.bargainor_id = this.so["OnlinePay_Tenpay_UserNumber"].Value.ToString(); if (this.GetQueryValueFromUrl(base.Request.QueryString, out errmsg)) { if (this.pay_result != 0) { base.Response.Write("<script type=\"text/javascript\">alert(\"支付号为 " + this.sp_billno + " 的支付记录没有充值成功,描述:" + this.payerrmsg + "\");</script>"); } else { try { string memo = "系统交易号:" + this.sp_billno + ",财付通交易号:" + this.transaction_id; int returnValue = -1; string returnDescription = ""; DataTable table = new Tables.T_UserPayDetails().Open("", "ID=" + this.sp_billno, ""); if ((table == null) || (table.Rows.Count <= 0)) { base.Response.Write("<script type=\"text/javascript\">alert(\"支付号为 " + this.sp_billno + " 的支付记录没有充值成功,描述:充值处理失败,本条数据丢失。\");</script>"); } else { double money = _Convert.StrToDouble(table.Rows[0]["Money"].ToString(), 0.0); long userID = _Convert.StrToLong(table.Rows[0]["UserID"].ToString(), 0L); double formalitiesFees = _Convert.StrToDouble(table.Rows[0]["FormalitiesFees"].ToString(), 0.0); string[] strArray = table.Rows[0]["PayType"].ToString().Split(new char[] { '_' }); string bankCode = (strArray.Length < 2) ? "" : strArray[1]; if (Procedures.P_UserAddMoney(base._Site.ID, userID, money, formalitiesFees, this.sp_billno, this.getBankName(bankCode), memo, ref returnValue, ref returnDescription) < 0) { base.Response.Write("<script type=\"text/javascript\">alert(\"支付号为 " + this.sp_billno + " 的支付记录没有充值成功,描述:数据库读写错误\");</script>"); } else if (returnValue < 0) { base.Response.Write("<script type=\"text/javascript\">alert(\"" + returnDescription + "\");</script>"); } else { base.Response.Write("<script type=\"text/javascript\">alert(\"此笔充值记录已到帐并已处理成功!\");</script>"); } } } catch { base.Response.Write("<script type=\"text/javascript\">alert(\"支付号为 " + this.sp_billno + " 的支付记录没有充值成功,描述:查询失败,可能是网络通讯故障。请重试一次。\");</script>"); } } } else { errmsg = "认证签名失败"; base.Response.Write("<script type=\"text/javascript\">alert(\"支付号为 " + this.sp_billno + " 的支付记录没有充值成功,描述:" + errmsg + "\");</script>"); } }
protected void gUserPay_ItemCommand(object source, DataGridCommandEventArgs e) { HiddenField tdUserPayID = (HiddenField)e.Item.FindControl("tdUserPayDetail"); if (tdUserPayID == null) { return; } int PayID = Shove._Convert.StrToInt(tdUserPayID.Value.ToString(), 0); if (PayID == 0) { return; } string payType = ""; string Money = ""; string time = ""; if (e.CommandName == "ShowUserPayDetail") { try { this.isShowUserPay.Visible = false; DataTable dt = new DAL.Tables.T_UserPayDetails().Open("PayType , [Money] , [DateTime]", "id = " + PayID, ""); payType = dt.Rows[0]["PayType"].ToString(); Money = dt.Rows[0]["Money"].ToString(); time = dt.Rows[0]["DateTime"].ToString(); this.lblUserPayBank.Text = getBankName(payType); //== "alipay" ? "支付宝充值" :"网银充值"; } catch { } this.lblUserPayMoneys.Text = Money.Substring(0, Money.IndexOf('.')) + Money.Substring(Money.IndexOf('.'), 3); this.lblUserPayTime.Text = time; } BindUserPayData(); //BindDistills(); }
protected void gUserPay_ItemCommand(object source, DataGridCommandEventArgs e) { HiddenField field = (HiddenField)e.Item.FindControl("tdUserPayDetail"); int num = _Convert.StrToInt(field.Value.ToString(), 0); string bankCode = ""; string str2 = ""; string str3 = ""; if (e.CommandName == "ShowUserPayDetail") { this.isShowUserPay.Visible = true; DataTable table = new Tables.T_UserPayDetails().Open("PayType , [Money] , [DateTime]", "id = " + num, ""); bankCode = table.Rows[0]["PayType"].ToString(); str2 = table.Rows[0]["Money"].ToString(); str3 = table.Rows[0]["DateTime"].ToString(); this.lblUserPayBank.Text = this.getBankName(bankCode); this.lblUserPayMoneys.Text = str2.Substring(0, str2.IndexOf('.')) + str2.Substring(str2.IndexOf('.'), 3); this.lblUserPayTime.Text = str3; } this.BindUserPayData(); this.BindDistills(); }
private bool WriteUserAccount(string Memo) { //这里手续费的计算与网银的不一样,网银充值10元,那么实充就是10,但是手机卡充值10元,实充就要小于10元 double FormalitiesFeesScale = so["OnlinePay_ZhiFuKa_PayFormalitiesFeesScale"].ToDouble(0) / 100; double FormalitiesFees = Math.Round(ordermoney * FormalitiesFeesScale, 2); ordermoney -= FormalitiesFees; string ReturnDescription = ""; bool ok = (_User.AddUserBalance(ordermoney, FormalitiesFees, sdcustomno,getBankName(cardno), Memo, ref ReturnDescription) == 0); if (!ok) { DataTable dt = new DAL.Tables.T_UserPayDetails().Open("Result", "[id] = " + Shove._Convert.StrToLong(sdcustomno, 0).ToString(), ""); if (dt == null || dt.Rows.Count == 0) { //new Log("OnlinePay").Write("在线支付:充值未完成。错误描述:返回的交易号找不到对应的数据"); return false; } int IsOK = Shove._Convert.StrToInt(dt.Rows[0][0].ToString(), 0); if (IsOK == 1) { return true; } else { //new Log("OnlinePay").Write("在线支付:充值未完成。错误描述:对应的数据未处理"); return false; } } return ok; }
protected void Page_Load(object sender, EventArgs e) { string returnUrl = Shove._Web.Utility.GetUrl() + "/Home/Room/OnlinePay/"; try { SettingParams(); } catch (Exception ee) { errorMessage = "007在线充值:充值未完成。错误描述:参数有误 详细:" + ee.Message; new Log("OnlinePay").Write(errorMessage); Response.Redirect(returnUrl + "Fail.aspx?errMsg=" + errorMessage); return; } key = so["OnlinePay_007Ka_Key"].ToString(""); if (Request.QueryString.AllKeys.Length < 1) { errorMessage = "007在线充值:充值未完成。错误描述:数据传输错误!"; new Log("OnlinePay").Write(errorMessage); Response.Redirect(returnUrl + "Fail.aspx?errMsg=" + errorMessage); return; } if (SignCounterpart != GetMD5(Orderinfo)) { errorMessage = "007在线充值:充值未完成。错误描述:认证签名失败!"; new Log("OnlinePay").Write(errorMessage); Response.Redirect(returnUrl + "Fail.aspx?errMsg=" + errorMessage); return; } if (MerID != so["OnlinePay_007Ka_MerchantId"].ToString("").Trim()) { errorMessage = "007在线充值:充值未完成。错误描述:商户号错误,数据非法!"; new Log("OnlinePay").Write(errorMessage); Response.Redirect(returnUrl + "Fail.aspx?errMsg=" + errorMessage); return; } if (MerAccount != so["OnlinePay_007Ka_MerAccount"].ToString("").Trim()) { errorMessage = "007在线充值:充值未完成。错误描述:商户银行账号错误,数据非法!"; new Log("OnlinePay").Write(errorMessage); Response.Redirect(returnUrl + "Fail.aspx?errMsg=" + errorMessage); return; } if (TranStat.ToString().Trim() != "1" && TranStat.ToString().Trim() != "29") { errorMessage = "007充值失败。"; new Log("OnlinePay").Write(errorMessage + " 错误号:" + TranStat.ToString()+" 错误描述:"+TranInfo); Response.Redirect(returnUrl + "Fail.aspx?errMsg=" + errorMessage); return; } DataTable dt = new DAL.Tables.T_UserPayDetails().Open("Result,UserID", "ID=" + OrderID, ""); if (dt == null || dt.Rows.Count < 1) { errorMessage = "007在线充值:充值未完成。错误描述:生成支付流水号未成功。"; new Log("OnlinePay").Write(errorMessage); Response.Redirect(returnUrl + "Fail.aspx?errMsg=" + errorMessage); return; } else { if (Shove._Convert.StrToLong(dt.Rows[0][1].ToString(), 0) != 0) { if (Shove._Convert.StrToInt(dt.Rows[0][0].ToString(), 0) == 1) { errorMessage = OrderID + "订单充值已经成功!"; Response.Write("OK"); new Log("OnlinePay").Write(errorMessage); Shove._Web.JavaScript.Alert(this.Page, errorMessage); return; } string returnDescription = ""; double FormalitiesFeesScale = so["OnlinePay_007Ka_FormalitiesFees"].ToDouble(0) / 100; double FormalitiesFees = Math.Round((Shove._Convert.StrToDouble(Value, 0)/100) * FormalitiesFeesScale, 2); Users user = new Users(_Site.ID)[_Site.ID, Shove._Convert.StrToLong(dt.Rows[0][1].ToString(), 0)]; int temp = user.AddUserBalance(Shove._Convert.StrToDouble(Value, 0)/100.0 - FormalitiesFees, FormalitiesFees, OrderID, "007Ka", "系统交易号:" + OrderID + "007Ka支付", ref returnDescription); if (temp < 0) { errorMessage = "增加电子货币错误。错误原因:" + returnDescription; new Log("OnlinePay").Write(errorMessage); Response.Redirect(returnUrl + "Fail.aspx?errMsg=" + errorMessage); return; } else { Response.Write("OK"); errorMessage = "007在线充值:充值完成!"; new Log("OnlinePay").Write(errorMessage); Response.Redirect(Shove._Web.Utility.GetUrl() + "/Home/Room/OnlinePay/OK.aspx?BuyID=" + Attach); return; } } else { errorMessage = "007在线充值:充值未完成。错误描述:用户不存在!"; new Log("OnlinePay").Write(errorMessage); Response.Redirect(Shove._Web.Utility.GetUrl() + "/Home/Room/OnlinePay/OK.aspx?BuyID=" + Attach); return; } } }
protected void Page_Load(object sender, EventArgs e) { string str = Utility.GetUrl() + "/Home/Room/OnlinePay/"; try { this.SettingParams(); } catch (Exception exception) { this.errorMessage = "007在线充值:充值未完成。错误描述:参数有误 详细:" + exception.Message; new Log("OnlinePay").Write(this.errorMessage); base.Response.Redirect(str + "Fail.aspx?errMsg=" + this.errorMessage); return; } this.key = this.so["OnlinePay_007Ka_Key"].ToString(""); if (base.Request.QueryString.AllKeys.Length >= 1) { if (this.SignCounterpart != this.GetMD5(this.Orderinfo)) { this.errorMessage = "007在线充值:充值未完成。错误描述:认证签名失败!"; new Log("OnlinePay").Write(this.errorMessage); base.Response.Redirect(str + "Fail.aspx?errMsg=" + this.errorMessage); } else if (this.MerID != this.so["OnlinePay_007Ka_MerchantId"].ToString("").Trim()) { this.errorMessage = "007在线充值:充值未完成。错误描述:商户号错误,数据非法!"; new Log("OnlinePay").Write(this.errorMessage); base.Response.Redirect(str + "Fail.aspx?errMsg=" + this.errorMessage); } else if (this.MerAccount != this.so["OnlinePay_007Ka_MerAccount"].ToString("").Trim()) { this.errorMessage = "007在线充值:充值未完成。错误描述:商户银行账号错误,数据非法!"; new Log("OnlinePay").Write(this.errorMessage); base.Response.Redirect(str + "Fail.aspx?errMsg=" + this.errorMessage); } else if ((this.TranStat.ToString().Trim() != "1") && (this.TranStat.ToString().Trim() != "29")) { this.errorMessage = "007充值失败。"; new Log("OnlinePay").Write(this.errorMessage + " 错误号:" + this.TranStat.ToString() + " 错误描述:" + this.TranInfo); base.Response.Redirect(str + "Fail.aspx?errMsg=" + this.errorMessage); } else { DataTable table = new Tables.T_UserPayDetails().Open("Result,UserID", "ID=" + this.OrderID, ""); if ((table == null) || (table.Rows.Count < 1)) { this.errorMessage = "007在线充值:充值未完成。错误描述:生成支付流水号未成功。"; new Log("OnlinePay").Write(this.errorMessage); base.Response.Redirect(str + "Fail.aspx?errMsg=" + this.errorMessage); } else if (_Convert.StrToLong(table.Rows[0][1].ToString(), 0L) != 0L) { if (_Convert.StrToInt(table.Rows[0][0].ToString(), 0) == 1) { this.errorMessage = this.OrderID + "订单充值已经成功!"; base.Response.Write("OK"); new Log("OnlinePay").Write(this.errorMessage); JavaScript.Alert(this.Page, this.errorMessage); } else { string returnDescription = ""; double num = this.so["OnlinePay_007Ka_FormalitiesFees"].ToDouble(0.0) / 100.0; double formalitiesFees = Math.Round((double)((_Convert.StrToDouble(this.Value, 0.0) / 100.0) * num), 2); Users users = new Users(base._Site.ID)[base._Site.ID, _Convert.StrToLong(table.Rows[0][1].ToString(), 0L)]; if (users.AddUserBalance((_Convert.StrToDouble(this.Value, 0.0) / 100.0) - formalitiesFees, formalitiesFees, this.OrderID, "007Ka", "系统交易号:" + this.OrderID + "007Ka支付", ref returnDescription) < 0) { this.errorMessage = "增加电子货币错误。错误原因:" + returnDescription; new Log("OnlinePay").Write(this.errorMessage); base.Response.Redirect(str + "Fail.aspx?errMsg=" + this.errorMessage); } else { base.Response.Write("OK"); this.errorMessage = "007在线充值:充值完成!"; new Log("OnlinePay").Write(this.errorMessage); base.Response.Redirect(Utility.GetUrl() + "/Home/Room/OnlinePay/OK.aspx?BuyID=" + this.Attach); } } } else { this.errorMessage = "007在线充值:充值未完成。错误描述:用户不存在!"; new Log("OnlinePay").Write(this.errorMessage); base.Response.Redirect(Utility.GetUrl() + "/Home/Room/OnlinePay/OK.aspx?BuyID=" + this.Attach); } } } else { this.errorMessage = "007在线充值:充值未完成。错误描述:数据传输错误!"; new Log("OnlinePay").Write(this.errorMessage); base.Response.Redirect(str + "Fail.aspx?errMsg=" + this.errorMessage); } }
private bool WriteUserAccount(string Memo) { double num = this.so["OnlinePay_ZhiFuKa_PayFormalitiesFeesScale"].ToDouble(0.0) / 100.0; double formalitiesFees = Math.Round((double)(this.ordermoney * num), 2); this.ordermoney -= formalitiesFees; string returnDescription = ""; bool flag = base._User.AddUserBalance(this.ordermoney, formalitiesFees, this.sdcustomno, this.getBankName(this.cardno), Memo, ref returnDescription) == 0; if (flag) { return flag; } DataTable table = new Tables.T_UserPayDetails().Open("Result", "[id] = " + _Convert.StrToLong(this.sdcustomno, 0L).ToString(), ""); if ((table == null) || (table.Rows.Count == 0)) { return false; } return (_Convert.StrToInt(table.Rows[0][0].ToString(), 0) == 1); }
private bool WriteUserAccount(Users user) { double Money = Shove._Convert.StrToDouble(c_orderamount, 0); if (Money == 0) { return false; } double FormalitiesFeesScale = so["OnlinePay_CnCard_CommissionScale"].ToDouble(0) / 100; double FormalitiesFees = Money - Math.Round(Money / (FormalitiesFeesScale + 1), 2); Money -= FormalitiesFees; string ReturnDescription = ""; bool ok = (user.AddUserBalance(Money, FormalitiesFees, c_order, "云网支付," + c_transnum, "", ref ReturnDescription) == 0); if (!ok) { DataTable dt = new DAL.Tables.T_UserPayDetails().Open("Result", "[id] = " + Shove._Convert.StrToLong(c_order, 0).ToString(), ""); if (dt == null || dt.Rows.Count == 0) { new Log(this.GetType().FullName).Write("返回的交易号找不到对应的数据"); return false; } int IsOK = Shove._Convert.StrToInt(dt.Rows[0][0].ToString(), 0); if (IsOK == 1) { return true; } else { new Log(this.GetType().FullName).Write("对应的数据未处理"); return false; } } return ok; }
private bool WriteUserAccount(Users thisUser, string PayNumber, double PayMoney, string Memo) { if (PayMoney > 0.0) { double num = this.so["OnlinePay_99Bill_PayFormalitiesFeesScale"].ToDouble(0.0) / 100.0; double formalitiesFees = PayMoney - Math.Round((double)(PayMoney / (num + 1.0)), 2); double money = PayMoney - formalitiesFees; string returnDescription = ""; bool flag = thisUser.AddUserBalance(money, formalitiesFees, PayNumber, "快钱", Memo, ref returnDescription) == 0; if (flag) { return flag; } DataTable table = new Tables.T_UserPayDetails().Open("Result", "[id] = " + _Convert.StrToLong(PayNumber, 0L).ToString(), ""); if ((table == null) || (table.Rows.Count == 0)) { new Log("OnlinePay").Write("[快钱]在线支付:返回的交易号找不到对应的数据"); return false; } if (_Convert.StrToInt(table.Rows[0][0].ToString(), 0) == 1) { return true; } new Log("OnlinePay").Write("[快钱]在线支付:对应的数据未处理"); } return false; }
//充值写入账户 private bool WriteUserAccount(Users _User, string Id, string amount, string Memo) { //充值金额 double Money = Shove._Convert.StrToDouble(amount, 0); if (Money == 0) { return false; } string ReturnDescription = ""; bool ok = (_User.AddUserBalance(Money, 0, Id, "", Memo, ref ReturnDescription) == 0); if (!ok) { DataTable dt = new DAL.Tables.T_UserPayDetails().Open("Result", "[PayNumber] = '" + Id + "'", ""); if (dt == null || dt.Rows.Count == 0) { new Log("System").Write("在线支付:返回的交易号找不到对应的数据"); return false; } int IsOK = Shove._Convert.StrToInt(dt.Rows[0][0].ToString(), 0); if (IsOK == 1) { return true; } else { new Log("System").Write("在线支付:对应的数据未处理"); return false; } } return ok; }
protected void Page_Load(object sender, EventArgs e) { //卖家商户号 customerid = so["OnlinePay_ZhiFuKa_UserNumber"].Value.ToString(); //卖家商户key key = so["OnlinePay_ZhiFuKa_MD5Key"].Value.ToString(); sdcustomno = Shove._Web.Utility.GetRequest("sdcustomno"); if (string.IsNullOrEmpty(sdcustomno) || string.IsNullOrEmpty(customerid) || string.IsNullOrEmpty(key)) { Response.Write("<script type=\"text/javascript\">alert(\"支付号为 " + sdcustomno + " 的支付记录没有充值成功,描述:参数不齐全,无法提交查询!\"); window.location.href='';</script>"); return; } string url = ""; if (!GetQueryUrl(out url)) { Response.Write("<script type=\"text/javascript\">alert(\"支付号为 " + sdcustomno + " 的支付记录没有充值成功,描述:" + url + "!\");window.location.href='';</script>"); return; } else { string msg = ""; if (GetResponseContents(GetHtml(url, "GB2312", 200), out msg)) { Response.Write("<script type=\"text/javascript\">alert(\"支付号为 " + sdcustomno + " 的支付记录没有充值成功,描述:" + msg + "!\"); window.location.href='';</script>"); return; } //如果,充值成功,那么我们完成充值 try { string Memo = "系统交易号:" + sdcustomno + ",51支付交易号:" + sd51no; int ReturnValue = -1; string ReturnDescription = ""; int Results = -1; DAL.Tables.T_UserPayDetails t_paydetails = new DAL.Tables.T_UserPayDetails(); DataTable tmptTB = t_paydetails.Open("", "ID=" + sdcustomno, ""); if (tmptTB == null || tmptTB.Rows.Count <= 0) { Shove._Web.JavaScript.Alert(this.Page, "支付号为 " + sdcustomno + " 的支付记录没有充值成功,描述:充值处理失败,本条数据丢失。"); return; } double Money = (ordermoney == -1 ? ordermoney : Shove._Convert.StrToDouble(tmptTB.Rows[0]["Money"].ToString(), 0)); long ID = Shove._Convert.StrToLong(tmptTB.Rows[0]["UserID"].ToString(), 0); double FormalitiesFees = Shove._Convert.StrToDouble(tmptTB.Rows[0]["FormalitiesFees"].ToString(), 0); string[] banks = tmptTB.Rows[0]["PayType"].ToString().Split('_'); string PayBank = banks.Length < 2 ? "" : banks[1]; Results = DAL.Procedures.P_UserAddMoney(_Site.ID, ID, Money, FormalitiesFees, sdcustomno,getBankName(PayBank), Memo, ref ReturnValue, ref ReturnDescription); if (Results < 0) { Shove._Web.JavaScript.Alert(this.Page, "支付号为 " + sdcustomno + " 的支付记录没有充值成功,描述:数据库读写错误"); return; } else { if (ReturnValue < 0) { Shove._Web.JavaScript.Alert(this.Page, ReturnDescription); return; } Shove._Web.JavaScript.Alert(this.Page, "此笔充值记录已到帐并已处理成功!"); } } catch { Shove._Web.JavaScript.Alert(this.Page, "支付号为 " + sdcustomno + " 的支付记录没有充值成功,描述:查询失败,可能是网络通讯故障。请重试一次。"); return; } } }
////获取远程服务器ATN结果 //public String Get_Http(String a_strUrl, int timeout) //{ // string strResult; // try // { // HttpWebRequest myReq = (HttpWebRequest)HttpWebRequest.Create(a_strUrl); // myReq.Timeout = timeout; // HttpWebResponse HttpWResp = (HttpWebResponse)myReq.GetResponse(); // Stream myStream = HttpWResp.GetResponseStream(); // StreamReader sr = new StreamReader(myStream, Encoding.Default); // StringBuilder strBuilder = new StringBuilder(); // while (-1 != sr.Peek()) // { // strBuilder.Append(sr.ReadLine()); // } // strResult = strBuilder.ToString(); // } // catch (Exception exp) // { // strResult = "错误:" + exp.Message; // } // return strResult; //} private bool WriteUserAccount(Users _User, string orderid, string amount, string Memo) { double Money = Shove._Convert.StrToDouble(amount, 0); if (Money == 0) { return false; } double FormalitiesFeesScale = so["OnlinePay_Alipay_PayFormalitiesFeesScale"].ToDouble(0) / 100; double FormalitiesFees = Money - Math.Round(Money / (FormalitiesFeesScale + 1), 2); Money -= FormalitiesFees; string ReturnDescription = ""; bool ok = (_User.AddUserBalance(Money, FormalitiesFees, orderid, "支付宝支付," + so["OnlinePay_Alipay_UserName"].ToString(""), Memo, ref ReturnDescription) == 0); if (!ok) { DataTable dt = new DAL.Tables.T_UserPayDetails().Open("Result", "[id] = " + Shove._Convert.StrToLong(orderid, 0).ToString(), ""); if (dt == null || dt.Rows.Count == 0) { new Log("System").Write("在线支付:返回的交易号找不到对应的数据"); return false; } int IsOK = Shove._Convert.StrToInt(dt.Rows[0][0].ToString(), 0); if (IsOK == 1) { return true; } else { new Log("System").Write("在线支付:对应的数据未处理"); return false; } } return ok; }
protected void Page_Load(object sender, EventArgs e) { this.customerid = this.so["OnlinePay_ZhiFuKa_UserNumber"].Value.ToString(); this.key = this.so["OnlinePay_ZhiFuKa_MD5Key"].Value.ToString(); this.sdcustomno = Utility.GetRequest("sdcustomno"); if ((string.IsNullOrEmpty(this.sdcustomno) || string.IsNullOrEmpty(this.customerid)) || string.IsNullOrEmpty(this.key)) { base.Response.Write("<script type=\"text/javascript\">alert(\"支付号为 " + this.sdcustomno + " 的支付记录没有充值成功,描述:参数不齐全,无法提交查询!\"); window.location.href='';</script>"); } else { string url = ""; if (!this.GetQueryUrl(out url)) { base.Response.Write("<script type=\"text/javascript\">alert(\"支付号为 " + this.sdcustomno + " 的支付记录没有充值成功,描述:" + url + "!\");window.location.href='';</script>"); } else { string str2 = ""; if (this.GetResponseContents(this.GetHtml(url, "GB2312", 200), out str2)) { base.Response.Write("<script type=\"text/javascript\">alert(\"支付号为 " + this.sdcustomno + " 的支付记录没有充值成功,描述:" + str2 + "!\"); window.location.href='';</script>"); } else { try { string memo = "系统交易号:" + this.sdcustomno + ",51支付交易号:" + this.sd51no; int returnValue = -1; string returnDescription = ""; DataTable table = new Tables.T_UserPayDetails().Open("", "ID=" + this.sdcustomno, ""); if ((table == null) || (table.Rows.Count <= 0)) { JavaScript.Alert(this.Page, "支付号为 " + this.sdcustomno + " 的支付记录没有充值成功,描述:充值处理失败,本条数据丢失。"); } else { double money = (this.ordermoney == -1.0) ? this.ordermoney : _Convert.StrToDouble(table.Rows[0]["Money"].ToString(), 0.0); long userID = _Convert.StrToLong(table.Rows[0]["UserID"].ToString(), 0L); double formalitiesFees = _Convert.StrToDouble(table.Rows[0]["FormalitiesFees"].ToString(), 0.0); string[] strArray3 = table.Rows[0]["PayType"].ToString().Split(new char[] { '_' }); string bankCode = (strArray3.Length < 2) ? "" : strArray3[1]; if (Procedures.P_UserAddMoney(base._Site.ID, userID, money, formalitiesFees, this.sdcustomno, this.getBankName(bankCode), memo, ref returnValue, ref returnDescription) < 0) { JavaScript.Alert(this.Page, "支付号为 " + this.sdcustomno + " 的支付记录没有充值成功,描述:数据库读写错误"); } else if (returnValue < 0) { JavaScript.Alert(this.Page, returnDescription); } else { JavaScript.Alert(this.Page, "此笔充值记录已到帐并已处理成功!"); } } } catch { JavaScript.Alert(this.Page, "支付号为 " + this.sdcustomno + " 的支付记录没有充值成功,描述:查询失败,可能是网络通讯故障。请重试一次。"); } } } } }