public static string QuickPay(string sChannel, string sPhone, string sAccount, decimal dPrice, int iCount, string sBankName, string sGameNameC) { string sTranIP = ProvideCommon.GetRealIP(); string sTranDirect = string.Empty; string sGameName = sGameNameC.Split('|')[0]; switch (sChannel) { case "alipay": case "ibank": string sPTranID = TransPBLL.PointSalesInit(sChannel, sPhone, sAccount, dPrice, iCount, sTranIP); decimal dFeeScale = ChannelBLL.FeeScaleSel(sChannel); int iGamePoints = Convert.ToInt32(dPrice * 10 * dFeeScale); int iPayUserID = UserBll.UserIDSel(sAccount); string sGTranID = TransGBLL.GameSalesInit(sGameName, iGamePoints, sAccount, sPhone, iPayUserID, sTranIP); TranQuickBLL.TranQuickAdd(sGTranID, sPTranID); sTranDirect = AliPay.QuickPayDirect(sPTranID, dPrice, sChannel, sBankName, sAccount, sGameNameC); break; case "yp-szx": case "yp-dx": case "yp-lt": case "yp-zt": case "yp-sd": case "yp-jcard": case "yp-bank": sTranDirect = YeePayBuy.QuickPayDirect(sChannel, sPhone, sAccount, dPrice, iCount, sGameNameC); break; case "szfbank": string sTranID = TransPBLL.PointSalesInit(sChannel, sPhone, sAccount, dPrice, iCount, sTranIP); dFeeScale = ChannelBLL.FeeScaleSel(sChannel); iGamePoints = Convert.ToInt32(dPrice * 10 * dFeeScale); iPayUserID = UserBll.UserIDSel(sAccount); sGTranID = TransGBLL.GameSalesInit(sGameName, iGamePoints, sAccount, sPhone, iPayUserID, sTranIP); TranQuickBLL.TranQuickAdd(sGTranID, sTranID); sTranDirect = QdbPayBuy.QuickPayBegin(sTranID, sAccount, dPrice, sGameNameC); break; case "vpay": string sOrderID = TransPBLL.PointSalesInit(sChannel, sPhone, sAccount, dPrice, iCount, sTranIP); dFeeScale = ChannelBLL.FeeScaleSel(sChannel); iGamePoints = Convert.ToInt32(dPrice * 10 * dFeeScale); iPayUserID = UserBll.UserIDSel(sAccount); sGTranID = TransGBLL.GameSalesInit(sGameName, iGamePoints, sAccount, sPhone, iPayUserID, sTranIP); TranQuickBLL.TranQuickAdd(sGTranID, sOrderID); sTranDirect = VPayBuy.QuickPayBegin(sOrderID, sAccount, dPrice, sGameNameC); break; } return(sTranDirect); }
public static string QuickTenPaySubmit(HttpContext Context) { string sRes = string.Empty; //创建PayResponseHandler实例 PayResponseHandler resHandler = new PayResponseHandler(Context); resHandler.setKey(key); //判断签名 if (resHandler.isTenpaySign()) { //交易单号 string transaction_id = resHandler.getParameter("transaction_id"); //金额金额,以分为单位 string total_fee = resHandler.getParameter("total_fee"); //支付结果 string pay_result = resHandler.getParameter("pay_result"); string sp_billno = resHandler.getParameter("sp_billno"); string attach = resHandler.getParameter("attach"); if ("0".Equals(pay_result)) { //------------------------------ //处理业务开始 //------------------------------ //注意交易单不要重复处理 //注意判断返回金额 //------------------------------ //处理业务完毕 //------------------------------ string sTranID = string.Format("{0}{1}", sp_billno, attach.Split('|')[0]); decimal dPrice = decimal.Parse(total_fee) / 100; string sAccount = attach.Split('|')[1]; string sGameAbbre = attach.Split('|')[2]; string sTranIP = ProvideCommon.GetRealIP(); string sFromUrl = Context.Request.Url.ToString(); LastOfPayPointBLL.Add(sTranIP, ' ', sFromUrl, sTranID); int j = TransPBLL.PointSalesCommit(sTranID, sAccount, dPrice); if (0 == j) { string sGTranID = TranQuickBLL.TranQuickGTranIDSel(sTranID); TranQuickBLL.TranQuickUpdateP(sTranID); string sGTRes = string.Empty; if (sGameAbbre.IndexOf("sq") == -1) { sGTRes = PayAll.GameQuickPay(sGameAbbre, sAccount, dPrice, sGTranID); } else { string sRoleID = attach.Split('|')[3]; sGTRes = PayAll.sqQuickPay(sGameAbbre, sAccount, dPrice, sGTranID, sRoleID); } string sUrl = string.Empty; if (sGTRes == "0") { TranQuickBLL.TranQuickUpdateG(sGTranID); sUrl = string.Format("PayGSucc.aspx?TranID={0}&gn={1}&type=q", sGTranID, sGameAbbre); //调用doShow, 打印meta值跟js代码,告诉财付通处理成功,并在用户浏览器显示$show页面. resHandler.doShow(sUrl); } sRes = sGTRes; } else if (j == 6) { string sQuickState = TranQuickBLL.TransQuickStateSelByP(sTranID); string sGTranID = TranQuickBLL.TranQuickGTranIDSel(sTranID); if (sQuickState == "2") { string sUrl = string.Format("PayGSucc.aspx?TranID={0}&gn={1}&type=q", sGTranID, sGameAbbre); //调用doShow, 打印meta值跟js代码,告诉财付通处理成功,并在用户浏览器显示$show页面. resHandler.doShow(sUrl); sRes = "0"; } else if (sQuickState == "1") { string sGTRes = string.Empty; if (sGameAbbre.IndexOf("sq") == -1) { sGTRes = PayAll.GameQuickPay(sGameAbbre, sAccount, dPrice, sGTranID); } else { string sRoleID = attach.Split('|')[3]; sGTRes = PayAll.sqQuickPay(sGameAbbre, sAccount, dPrice, sGTranID, sRoleID); } if (sGTRes == "0") //游戏兑换成功 { TranQuickBLL.TranQuickUpdateG(sGTranID); string sUrl = string.Format("PayGSucc.aspx?TranID={0}&gn={1}&type=q", sGTranID, sGameAbbre); //调用doShow, 打印meta值跟js代码,告诉财付通处理成功,并在用户浏览器显示$show页面. resHandler.doShow(sUrl); sRes = "0"; } else { //sMsg = "<script>alert('充值武林币成功!游戏兑换失败!如有问题请与客服联系!');</script>"; sRes = "-3"; } } } else { sRes = "-4"; } } else { //当做不成功处理 sRes = "-1"; } } else { sRes = "-2"; } return(sRes); }
public static string QuickVPaySubmit() { string sRes = string.Empty; //'接受服务器url get参数 string rtmd5 = CYRequest.GetString("v1"); // '服务器MD5 string trka = CYRequest.GetString("v2"); // 'V币号码15位 string rtmi = CYRequest.GetString("v3"); // '密码'V币密码6位 (可能为空 老V币没有密码) string rtmz = CYRequest.GetString("v4"); // '面值1-999 整数 string rtlx = CYRequest.GetString("v5"); // '卡的类型 1 2 3 string rtoid = CYRequest.GetString("v6"); // '网盈一号通服务器端订单 string rtcoid = CYRequest.GetString("v7"); // '商户自己订单 string rtuserid = CYRequest.GetString("v8"); // '商户的用户ID string rtcustom = CYRequest.GetString("v9"); //'商户自己定义数据 string rtflag = CYRequest.GetString("v10"); // '返回状态. 1正常发送 2补单发送 StringBuilder sbText = new StringBuilder(); sbText.Append(trka); sbText.Append(rtmi); sbText.Append(rtoid); sbText.Append(spid); sbText.Append(sppwd); sbText.Append(rtcoid); sbText.Append(rtflag); sbText.Append(rtmz); string get_key = sbText.ToString();//string get_key = trka + rtmi + rtoid + spid + sppwd + rtcoid + rtflag + rtmz; //'卡+密+网盈一号通服务器端订单+ 5位spid+ 18位SP密码+商户订单+rtflag返回类型1或2 +面值 //'LCase函数是将字符转换为小写; Ucase函数是将字符转换为大写 //'全国声讯支付联盟全国声讯电话支付接口对MD5值只认大写字符串,所以小写的MD5值得转换为大写 string md5password = ProvideCommon.MD5(get_key).ToUpper(); // '先MD5 32 然后转大写 if (md5password == rtmd5) { decimal dRtmz = decimal.Parse(rtmz) / 2; string sTranID = string.Format("{0}{1}", rtcoid, rtcustom.Split('|')[0]); string sGTranID = TranQuickBLL.TranQuickGTranIDSel(sTranID); TranQuickBLL.TranQuickUpdateP(sTranID); string sGameName = rtcustom.Split('|')[1]; string sGTRes = string.Empty; if (sGameName.IndexOf("sq") == -1) { sGTRes = PayAll.GameQuickPay(sGameName, rtuserid, dRtmz, sGTranID); } else { string sRoleID = rtcustom.Split('|')[2]; sGTRes = PayAll.sqQuickPay(sGameName, rtuserid, dRtmz, sGTranID, sRoleID); } sbText.Remove(0, sbText.Length); if (sGTRes == "0") { TranQuickBLL.TranQuickUpdateG(sGTranID); sbText.Append("1|"); } else { //游戏冲值失败 sbText.Append("3|"); } sbText.Append(sGTranID); sbText.AppendFormat("|{0}", rtcustom); sRes = sbText.ToString(); } else { sRes = "验证失败"; } return(sRes); }
public static string QuickYeePaySubmit() { string sRes = string.Empty; // 校验返回数据包 BuyCallbackResult result = Buy.VerifyCallback(p1_MerId, keyValue, Buy.GetQueryString("r0_Cmd"), Buy.GetQueryString("r1_Code"), Buy.GetQueryString("r2_TrxId"), Buy.GetQueryString("r3_Amt"), Buy.GetQueryString("r4_Cur"), Buy.GetQueryString("r5_Pid"), Buy.GetQueryString("r6_Order"), Buy.GetQueryString("r7_Uid"), Buy.GetQueryString("r8_MP"), Buy.GetQueryString("r9_BType"), Buy.GetQueryString("rp_PayDate"), Buy.GetQueryString("hmac")); if (string.IsNullOrEmpty(result.ErrMsg)) //校验返回数据包成功 { StringBuilder sbText = new StringBuilder(); if (result.R1_Code == "1") //返回充值成功的标识 { decimal dPrice = decimal.Parse(result.R3_Amt); int iPrice = Convert.ToInt32(dPrice); string sChannel = string.Empty; switch (Buy.GetQueryString("rb_BankId")) { case "SZX-NET": sChannel = "yp-szx"; break; case "TELECOM-NET": sChannel = "yp-dx"; break; case "UNICOM-NET": sChannel = "yp-lt"; break; case "ZHENGTU-NET": sChannel = "yp-zt"; break; case "SNDACARD-NET": sChannel = "yp-sd"; break; case "JUNNET-NET": sChannel = "yp-jcard"; break; default: sChannel = ""; break; } if (sChannel != "") { dPrice = dPrice * ChannelBLL.FeeScaleSel(sChannel); } if (result.R9_BType == "1") //返回方式1:浏览器重定向方式 { string sPTranID = result.R6_Order; string sAccount = result.R8_MP.Split('|')[0]; string sGame = result.R8_MP.Split('|')[1]; int iResNum = TransPBLL.PointSalesCommit(sPTranID, sAccount, iPrice); string sGTranID = TranQuickBLL.TranQuickGTranIDSel(sPTranID); if (0 == iResNum) { TranQuickBLL.TranQuickUpdateP(sPTranID); string sGTRes = string.Empty; if (sGame.IndexOf("sq") == -1) { sGTRes = PayAll.GameQuickPay(sGame, sAccount, dPrice, sGTranID); } else { string sRoleID = result.R8_MP.Split('|')[2]; sGTRes = PayAll.sqQuickPay(sGame, sAccount, dPrice, sGTranID, sRoleID); } if (sGTRes == "0") { TranQuickBLL.TranQuickUpdateG(sGTranID); sbText.Append("1|"); } else { //游戏冲值失败 sbText.Append("3|"); } sbText.Append(sGTranID); sbText.AppendFormat("|{0}", sGame); sRes = sbText.ToString(); } else { string sQuickState = TranQuickBLL.TransQuickStateSelByP(sPTranID); if (sQuickState == "2") { //游戏充值成功 sbText.Append("1|"); sbText.Append(sGTranID); sbText.AppendFormat("|{0}", sGame); sRes = sbText.ToString(); } else if (sQuickState == "1") { string sGTRes = string.Empty; if (sGame.IndexOf("sq") == -1) { sGTRes = PayAll.GameQuickPay(sGame, sAccount, dPrice, sGTranID); } else { string sRoleID = result.R8_MP.Split('|')[2]; sGTRes = PayAll.sqQuickPay(sGame, sAccount, dPrice, sGTranID, sRoleID); } if (sGTRes == "0") //游戏兑换成功 { TranQuickBLL.TranQuickUpdateG(sGTranID); //游戏充值成功 sbText.Append("1|"); } else { //游戏冲值失败 sbText.Append("3|"); } sbText.Append(sGTranID); sbText.AppendFormat("|{0}", sGame); sRes = sbText.ToString(); } else { sbText.Append("2|"); sbText.Append(sPTranID); sRes = sbText.ToString(); } } } else if (result.R9_BType == "2") { string sAccount = result.R8_MP.Split('|')[0]; string sGame = result.R8_MP.Split('|')[1]; string sPTranID = result.R6_Order; int iRes = TransPBLL.PointSalesCommit(sPTranID, sAccount, iPrice); string sGTranID = TranQuickBLL.TranQuickGTranIDSel(sPTranID); if (iRes == 0) { TranQuickBLL.TranQuickUpdateP(sPTranID); string sGTRes = string.Empty; if (sGame.IndexOf("sq") == -1) { sGTRes = PayAll.GameQuickPay(sGame, sAccount, dPrice, sGTranID); } else { string sRoleID = result.R8_MP.Split('|')[2]; sGTRes = PayAll.sqQuickPay(sGame, sAccount, dPrice, sGTranID, sRoleID); } if (sGTRes == "0") { TranQuickBLL.TranQuickUpdateG(sGTranID); } } sRes = "4"; } else if (result.R9_BType == "3") { sRes = "4"; } } else { sbText.Append("0|"); sbText.Append(result.R1_Code); sRes = sbText.ToString(); } } else { sRes = "0|valerr"; } return(sRes); }