public void GetWXJsApiParam() { string strOpenId = GlobalUtils.OpenId; if (strOpenId.IsEmpty()) { PrintJson("-1", "微信未授权,取不到OpenId值"); return; } Guid?userId = WebUserAuth.UserId; if (userId == null || userId == Guid.Empty) { PrintJson("-1", "对不起,您还未登录!"); return; } TuanDai.PortalSystem.BLL.UserBLL bll = new TuanDai.PortalSystem.BLL.UserBLL(); UserBasicInfoInfo userModel = bll.GetUserBasicInfoModelById(userId.Value); if (userModel == null) { PrintJson("-1", "对不起,该用户不存在!"); return; } decimal Amount = Tool.SafeConvert.ToDecimal(WEBRequest.GetFormString("Amount"), 0); decimal tmpAmount = Math.Floor(Amount * 100) / 100; if (tmpAmount != Amount) { PrintJson("-1", "充值金额最多只能2位小数,如106.32!"); return; } WebSettingInfo rechargeSet = new TuanDai.PortalSystem.DAL.WebSettingDAL().GetWebSettingInfo("9A89CBAE-6550-4EA1-8224-EB645F38F8FA"); decimal MinRechargeAmount = decimal.Parse(rechargeSet.Param1Value); if (Amount < MinRechargeAmount) { PrintJson("-1", "最低充值金额为" + MinRechargeAmount.ToString("N2") + "元!"); return; } if (Amount > 500000) { PrintJson("-1", "单次充值不能超过50万!"); return; } NoHandler noHandler = new NoHandler(); string orderNo = noHandler.OnLineRechare(); if (orderNo == "0") { PrintJson("-1", "您好,您的提交失败请重试!"); return; } int Sel = 9; //标记是微信支付 Guid rechargeId = Guid.NewGuid(); int outStatus = 0; string bankcode = ""; string userIP = Tool.WebFormHandler.GetIP(); //using (SqlConnection connection = TuanDai.PortalSystem.DAL.PubConstant.CrateConnection()) //{ var paramData = new Dapper.DynamicParameters(); paramData.Add("@userid", userId); paramData.Add("@type", Sel); paramData.Add("@amount", Amount); paramData.Add("@orderNo", orderNo); paramData.Add("@backcode", bankcode); paramData.Add("@clientIp", userIP); paramData.Add("@from", "5"); paramData.Add("@outStatus", 0, System.Data.DbType.Int32, System.Data.ParameterDirection.Output); TuanDai.DB.TuanDaiDB.Execute(TdConfig.DBFundWrite, "AccountRechargeInit", ref paramData, CommandType.StoredProcedure); outStatus = paramData.Get <int>("@outStatus"); // connection.Execute("AccountRechargeInit", paramData, null, null, System.Data.CommandType.StoredProcedure); // outStatus = paramData.Get<int>("@outStatus"); // connection.Close(); // connection.Dispose(); //} int result = outStatus; if (result > 0) { TuanDai.Payment.PaymentBLL jsApiPay = new TuanDai.Payment.PaymentBLL("JSAPI", strOpenId, orderNo, userModel.RealName, userModel.IdentityCard); TuanDai.Payment.WxPayData unifiedOrderResult = null; try { int PayAmount = int.Parse(double.Parse((Amount * 100).ToString()).ToString()); unifiedOrderResult = jsApiPay.WXJsApiUnifiedOrder(PayAmount.ToString()); } catch (Exception ex) { PrintJson("-1", ex.Message); return; } string wxJsApiParam = jsApiPay.GetJsApiParameters();//获取H5调起JS API参数 var jsonData = new { result = "1", msg = wxJsApiParam }; PrintJson(jsonData); } else { PrintJson("-1", "您好,您的提交失败请重试!"); return; } }
private void GetEBPayCheck() { Guid userid; if (WebUserAuth.UserId != null) { userid = WebUserAuth.UserId.Value; } else { PrintJson("0", "您还未登录!"); return; } decimal Amount = Tool.SafeConvert.ToDecimal(Request.QueryString["Amount"], 0); WebSettingInfo rechargeSet = new TuanDai.PortalSystem.DAL.WebSettingDAL().GetWebSettingInfo("9A89CBAE-6550-4EA1-8224-EB645F38F8FA"); decimal MinRechargeAmount = decimal.Parse(rechargeSet.Param1Value); if (Amount < MinRechargeAmount) { PrintJson("0", "您好,充值金额必须大于或者等于" + MinRechargeAmount.ToString("N2") + "!"); return; } if (Amount > 5000000) { PrintJson("0", "单次充值不能超过500万!"); return; } NoHandler noHandler = new NoHandler(); string orderNo = noHandler.OnLineRechare(); if (orderNo == "0") { PrintJson("0", "您好,您的提交失败请重试!"); return; } int Sel = 11; Guid rechargeId = Guid.NewGuid(); string bankcode = ""; string userIP = Tool.WebFormHandler.GetIP(); int outStatus = 0; DynamicParameters paras = new DynamicParameters(); paras.Add("@userid", userid); paras.Add("@type", Sel); paras.Add("@amount", Amount); paras.Add("@orderNo", orderNo); paras.Add("@backcode", bankcode); paras.Add("@clientIp", userIP); paras.Add("@from", "5"); paras.Add("@outStatus", 0, DbType.Int32, ParameterDirection.Output); PublicConn.ExecuteTD(PublicConn.DBWriteType.FundWrite, "AccountRechargeInit", ref paras, CommandType.StoredProcedure); outStatus = paras.Get <int>("@outStatus"); int result = outStatus; if (result <= 0) { PrintJson("0", "您好,您的提交失败请重试!"); } UserBLL bll = new UserBLL(); UserBasicInfoInfo userInfo = bll.GetUserBasicInfoModelById(userid); //获取个人信息 if (null == userInfo) { PrintJson("0", "获取用户信息错误!"); return; } //如果查询没有身份或者真实姓名 if (string.IsNullOrEmpty(userInfo.IdentityCard) || string.IsNullOrEmpty(userInfo.RealName) || !userInfo.IsValidateIdentity) { PrintJson("0", "没有获取到用户实名信息(身份证和真实姓名)"); return; } GetBankCardNo(userInfo, userid); //是否绑定银行卡 if (string.IsNullOrEmpty(userInfo.BankAccountNo)) { PrintJson("0", "银行卡未绑定"); return; } //是否绑定手机 if (string.IsNullOrEmpty(userInfo.TelNo) || !userInfo.IsValidateMobile) { PrintJson("0", "未完成手机或实名认证"); return; } EBRechargeInfo orderInfo = new EBRechargeInfo(); orderInfo.IsBindCard = 0; orderInfo.OrderId = orderNo; //申请充值 try { var bankAccountNo = userInfo.BankAccountNo.Trim(); var identityId = userInfo.Id.ToString().Replace("-", string.Empty).ToUpper(); var bindCardModel = BindBankCardList.GetBindCardList(identityId, bankAccountNo); var rechargeAmount = (int)(Amount * 100); if (bindCardModel == null) { var model = new BindCardRequestModel { CardNo = bankAccountNo, IdCardNo = userInfo.IdentityCard, IdentityId = identityId, Phone = userInfo.TelNo, RegisterPhone = userInfo.TelNo, UserName = userInfo.RealName, }; model.RequestId = string.Concat("D", identityId); orderInfo.RequestId = model.RequestId; BindBankCard.BindCard(model); } else { orderInfo.RequestId = string.Concat("D", identityId); orderInfo.IsBindCard = 1; BankCardPay.BindPay(new BankCardPayRequestModel { Amount = rechargeAmount, CallBackUrl = EBNotifyUrl, CardLast = bindCardModel.Card_Last, CardTop = bindCardModel.Card_Top, IdentityId = identityId, OrderId = orderNo }); } } catch (Exception ex) { SysLogHelper.WriteErrorLog("易宝充值出错:GetEBPayCheck", Tool.ExceptionHelper.GetExceptionMessage(ex)); PrintJson("0", "发生错误:" + ex.Message); return; } var ResponseData = new { result = "1", msg = JsonHelper.ToJson(orderInfo) }; PrintJson(ResponseData); }
protected void Page_Load(object sender, EventArgs e) { Guid userid = WebUserAuth.UserId.Value; var bankmodel = new BankInfoBLL().GetBankInfoListByUserId(userid); if (bankmodel != null && bankmodel.Count > 0) { if (bankmodel.Any(p => p.Status == 2)) { Response.Write("您好,银行卡在审核中不允许充值!"); ClientScript.RegisterStartupScript(this.GetType(), "ss", "<script>ShowMsg('您好,银行卡在审核中不允许充值!','1','确定');</script>"); return; } } decimal Amount = Tool.SafeConvert.ToDecimal(Request.Params["Amount"], 0); decimal tmpAmount = Math.Floor(Amount * 100) / 100; if (tmpAmount != Amount) { ClientScript.RegisterStartupScript(this.GetType(), "ss", "<script>ShowMsg('充值金额最多只能2位小数,如106.32!','1','确定');</script>"); return; } TuanDai.PortalSystem.Model.WebSettingInfo rechargeSet = new TuanDai.PortalSystem.DAL.WebSettingDAL().GetWebSettingInfo("9A89CBAE-6550-4EA1-8224-EB645F38F8FA"); decimal minRecharge = decimal.Parse(rechargeSet.Param1Value); if (Amount < minRecharge) { ClientScript.RegisterStartupScript(this.GetType(), "ss", "<script>ShowMsg('单次充值最少" + minRecharge.ToString("N2") + "元!','1','确定');</script>"); return; } if (Amount > 500000) { ClientScript.RegisterStartupScript(this.GetType(), "ss", "<script>ShowMsg('单次充值不能超过50万!','1','确定');</script>"); return; } NoHandler noHandler = new NoHandler(); string orderNo = noHandler.OnLineRechare(); if (orderNo == "0") { ClientScript.RegisterStartupScript(this.GetType(), "ss", "<script>ShowMsg('您好,您的提交失败请重试!','1','确定');</script>"); return; } int Sel = Tool.SafeConvert.ToInt32(Request.Params["Sel"], 8); Guid rechargeId = Guid.NewGuid(); int outStatus = 0; string bankcode = ""; if (Request.Params["bankcode"] != null) { bankcode = Request.Params["bankcode"]; } string userIP = Tool.WebFormHandler.GetIP(); var paramData = new Dapper.DynamicParameters(); paramData.Add("@userid", userid); paramData.Add("@type", Sel); paramData.Add("@amount", Amount); paramData.Add("@orderNo", orderNo); paramData.Add("@backcode", bankcode); paramData.Add("@clientIp", userIP); paramData.Add("@from", "5"); paramData.Add("@outStatus", 0, System.Data.DbType.Int32, System.Data.ParameterDirection.Output); PublicConn.ExecuteTD(PublicConn.DBWriteType.FundWrite, "AccountRechargeInit", ref paramData, CommandType.StoredProcedure); outStatus = paramData.Get <int>("@outStatus"); int result = outStatus; if (result > 0) { lock (lockstatus) { if (UpdateAccountRechare(5, orderNo) <= 0) { ClientScript.RegisterStartupScript(this.GetType(), "ss", "<script>ShowMsg('您好,您的提交失败请重试!','1','确定');</script>"); return; } Response.Redirect("/PaymentPlatform/lianlian/plainPay.aspx?orderno=" + orderNo + "&totalprice=" + Amount + "&bankcode=" + bankcode); } } else { ClientScript.RegisterStartupScript(this.GetType(), "ss", "<script>ShowMsg('您好,您的提交失败请重试!','1','确定');</script>"); } }
protected void Page_Load(object sender, EventArgs e) { Guid userid = WebUserAuth.UserId.Value; //if (GetBankInfo(userid, 2) == 1) //{ // //if (bankmodel.Status==2) // //{ // //Response.Write("您好,银行卡在审核中不允许充值!"); // ClientScript.RegisterStartupScript(this.GetType(), "ss", // "<script>ShowMsg('您好,银行卡在审核中不允许充值!','1','确定');</script>"); // return; // //} //} decimal Amount = Tool.SafeConvert.ToDecimal(Request.Params["Amount"], 0); decimal tmpAmount = Math.Floor(Amount * 100) / 100; if (tmpAmount != Amount) { ClientScript.RegisterStartupScript(this.GetType(), "ss", "<script>ShowMsg('充值金额最多只能2位小数,如106.32!','1','确定');</script>"); return; } TuanDai.PortalSystem.Model.WebSettingInfo rechargeSet = new TuanDai.PortalSystem.DAL.WebSettingDAL().GetWebSettingInfo("9A89CBAE-6550-4EA1-8224-EB645F38F8FA"); decimal minRecharge = decimal.Parse(rechargeSet.Param1Value); if (Amount < minRecharge) { ClientScript.RegisterStartupScript(this.GetType(), "ss", "<script>ShowMsg('单次充值最少" + minRecharge.ToString("N2") + "元!','1','确定');</script>"); return; } if (Amount > 500000) { ClientScript.RegisterStartupScript(this.GetType(), "ss", "<script>ShowMsg('单次充值不能超过50万!','1','确定');</script>"); return; } var cgtMode = new QueryClient().GetUserByPlatformUserNo(userid); if (cgtMode == null) { ClientScript.RegisterStartupScript(this.GetType(), "ss", "<script>ShowMsg('存管通未开通,不能进行充值!','1','确定');</script>"); return; } if (!cgtMode.isActivate) { ClientScript.RegisterStartupScript(this.GetType(), "ss", "<script>ShowMsg('存管通未激活,不能进行充值!','1','确定');</script>"); return; } NoHandler noHandler = new NoHandler(); string orderNo = noHandler.OnLineRechare(); if (orderNo == "0") { ClientScript.RegisterStartupScript(this.GetType(), "ss", "<script>ShowMsg('您好,您的提交失败请重试!','1','确定');</script>"); return; } string err = string.Empty; bool isRecharge = new CgtCheckBLL().GetUserCgtIsOper(userid, "recharge", ref err); if (!isRecharge) { ClientScript.RegisterStartupScript(this.GetType(), "ss", "<script>ShowMsg('" + err + "','1','确定');</script>"); return; } //获取银行卡号 string bankNo = Request["bankno"]; string outCode = string.Empty; if (!string.IsNullOrEmpty(bankNo)) { try { bankNo = Tool.DESC.Decrypt(bankNo); } catch (Exception) { bankNo = null; } } BankFromJavaService bankJavaService = new BankFromJavaService(); if (GlobalUtils.IsBankService) { var bankInfoFromJava = bankJavaService.GetBankInfo(userid, ServiceType.NotTuomin); if (bankInfoFromJava != null && bankInfoFromJava.respData != null) { bankNo = bankInfoFromJava.respData.bankNo; outCode = bankInfoFromJava.respData.bankCode; } } else { var userInfo = new PortalSystem.BLL.UserBLL().GetUserBasicInfoModelById(userid); if (userInfo == null || string.IsNullOrEmpty(userInfo.BankAccountNo)) { var bankInfo = GlobalUtils.GetBankInfo(userid); bankNo = bankInfo.BankNo; } else { bankNo = userInfo.BankAccountNo; } } string userIP = Tool.WebFormHandler.GetIP(); if (!GlobalUtils.IsBankService) { var sss = TuanDai.Payment.Client.BankInfo.GetPayBankInfo(userid); TuanDai.Payment.Models.PayRoute.RouteInfo bank = new TuanDai.Payment.Client.Recharge().GetCgtRechargeInfo(userid, sss.BankNo); int Sel = bank.Sel; int outStatus = 0; string bankcode = ""; if (Request.Params["bankcode"] != null) { bankcode = Request.Params["bankcode"]; } var paramData = new Dapper.DynamicParameters(); paramData.Add("@userid", userid); paramData.Add("@type", Sel); paramData.Add("@amount", Amount); paramData.Add("@orderNo", orderNo); paramData.Add("@backcode", bankcode); paramData.Add("@clientIp", userIP); paramData.Add("@from", "5"); if (bank.RouteId.IsEmpty()) { paramData.Add("@RouteId", null); } else { paramData.Add("@RouteId", bank.RouteId); } paramData.Add("@outStatus", 0, System.Data.DbType.Int32, System.Data.ParameterDirection.Output); paramData.Add("@cmorderNo", ""); PublicConn.ExecuteTD(PublicConn.DBWriteType.FundWrite, "p_cgt_AccountRechargeInit", ref paramData, CommandType.StoredProcedure); outStatus = paramData.Get <int>("@outStatus"); int result = outStatus; if (result > 0) { lock (lockstatus) { var isCallBackPayment = System.Configuration.ConfigurationManager.AppSettings["IsCallBackPayment"]; var paymentUrl = System.Configuration.ConfigurationManager.AppSettings["PaymentUrl"]; string callBackUrl = paymentUrl + "/PaymentPlatform/H5/commonCallBack.aspx"; if (isCallBackPayment == "0") { callBackUrl = CgtCallBackConfig.GetCgtCallBackUrl(CgtCallBackConfig.CgtCallBackType.Recharge); } var recharInfo = new Payment.Client.Recharge().GetCgtRechargeInfo(userid, bankNo); var url = CunGuanTong.Client.FundClient.RECHARGE_Req(new CunGuanTong.Model.RECHARGE_Request { rechargeWay = rechargeWay.SWIFT, requestNo = orderNo, amount = Amount, bankcode = recharInfo.OutCode, callbackMode = "DIRECT_CALLBACK", platformUserNo = userid.ToString(), expectPayCompany = recharInfo.CgtPayCompany, //callbackUrl = CgtCallBackConfig.GetCgtCallBackUrl(CgtCallBackConfig.CgtCallBackType.Recharge), callbackUrl = callBackUrl, userDevice = CunGuanTong.Model.userDevice.MOBILE }); if (string.IsNullOrEmpty(url)) { if (Request.UrlReferrer != null) { url = Request.UrlReferrer.ToString(); } else { url = GlobalUtils.WebURL; } } Response.Redirect(url); } } else { ClientScript.RegisterStartupScript(this.GetType(), "ss", "<script>ShowMsg('您好,充值提交失败请重试!','1','确定');</script>"); } } else { //走Java银行卡服务 string retUrl = bankJavaService.GetCgtRechargeUrl(userid, bankNo, Amount, userIP, outCode); if (!string.IsNullOrEmpty(retUrl)) { Response.Redirect(retUrl); } } }
public void GetWXJsApiParam() { string strOpenId = GlobalUtils.OpenId; if (strOpenId.IsEmpty()) { PrintJson("-1", "微信未授权,取不到OpenId值"); return; } Guid?userId = WebUserAuth.UserId; if (userId == null || userId == Guid.Empty) { PrintJson("-1", "对不起,您还未登录!"); return; } decimal Amount = Tool.SafeConvert.ToDecimal(WEBRequest.GetQueryString("Amount"), 0); WebSettingInfo rechargeSet = new TuanDai.PortalSystem.DAL.WebSettingDAL().GetWebSettingInfo("9A89CBAE-6550-4EA1-8224-EB645F38F8FA"); decimal MinRechargeAmount = decimal.Parse(rechargeSet.Param1Value); if (Amount < MinRechargeAmount) { PrintJson("-1", "最低充值金额为" + MinRechargeAmount.ToString("N2") + "元!"); return; } if (Amount > 500000) { PrintJson("-1", "单次充值不能超过50万!"); return; } NoHandler noHandler = new NoHandler(); string orderNo = noHandler.OnLineRechare(); if (orderNo == "0") { PrintJson("-1", "您好,您的提交失败请重试!"); return; } int Sel = 9; //标记是微信支付 Guid rechargeId = Guid.NewGuid(); int outStatus = 0; string bankcode = ""; string userIP = Tool.WebFormHandler.GetIP(); DynamicParameters paramData = new DynamicParameters(); paramData.Add("@userid", userId); paramData.Add("@type", Sel); paramData.Add("@amount", Amount); paramData.Add("@orderNo", orderNo); paramData.Add("@backcode", bankcode); paramData.Add("@clientIp", userIP); paramData.Add("@from", "5"); paramData.Add("@outStatus", 0, System.Data.DbType.Int32, System.Data.ParameterDirection.Output); PublicConn.ExecuteTD(PublicConn.DBWriteType.FundWrite, "AccountRechargeInit", ref paramData, System.Data.CommandType.StoredProcedure); outStatus = paramData.Get <int>("@outStatus"); int result = outStatus; if (result > 0) { TuanDai.Payment.PaymentBLL jsApiPay = new TuanDai.Payment.PaymentBLL("JSAPI", strOpenId, orderNo, userModel.RealName, userModel.IdentityCard); TuanDai.Payment.WxPayData unifiedOrderResult = null; try { int PayAmount = int.Parse(double.Parse((Amount * 100).ToString()).ToString()); unifiedOrderResult = jsApiPay.WXJsApiUnifiedOrder(PayAmount.ToString()); } catch (Exception ex) { PrintJson("-1", ex.Message); return; } wxJsApiParam = jsApiPay.GetJsApiParameters();//获取H5调起JS API参数 PrintJson("1", ""); } else { PrintJson("-1", "您好,您的提交失败请重试!"); return; } }
protected void Page_Load(object sender, EventArgs e) { Guid userid = WebUserAuth.UserId.Value; decimal Amount = Tool.SafeConvert.ToDecimal(Request.Params["Amount"], 0); //if (Amount < 100) //{ // Response.Write("您好,充值金额必须大于或者等于100!"); // return; //} if (Amount > 5000000) { Response.Write("单次充值不能超过500万!"); return; } NoHandler noHandler = new NoHandler(); string orderNo = noHandler.OnLineRechare(); if (orderNo == "0") { Response.Write("您好,您的提交失败请重试!"); return; } int Sel = Tool.SafeConvert.ToInt32(Request.Params["Sel"], 12); Guid rechargeId = Guid.NewGuid(); int outStatus = 0; //string bankcode = ""; //bankcode = Request.Params["bankcode"]; ////if (Request.Params["bankcode"] != null) ////{ ////} //if (string.IsNullOrEmpty(bankcode)) //{ // Response.Write("您好,银行编号获取错误!" + Request.QueryString["bankcode"]); // return; //} string userIP = Tool.WebFormHandler.GetIP(); var paramData = new Dapper.DynamicParameters(); paramData.Add("@userid", userid); paramData.Add("@type", Sel); paramData.Add("@amount", Amount); paramData.Add("@orderNo", orderNo); paramData.Add("@backcode", ""); paramData.Add("@clientIp", userIP); paramData.Add("@from", "5"); paramData.Add("@outStatus", 0, System.Data.DbType.Int32, System.Data.ParameterDirection.Output); TuanDai.WXApiWeb.PublicConn.ExecuteTD(PublicConn.DBWriteType.FundWrite, "AccountRechargeInit", ref paramData, CommandType.StoredProcedure); outStatus = paramData.Get <int>("@outStatus"); int result = outStatus; //NetLog.WriteLoginHandler("宝付5-调用写入充值记录存储过AccountRechargeInit", "UserId:"+userid+",Sel:"+Sel+",Amount:"+Amount+",OrderNo:"+orderNo+",bankcode:"+bankcode+",OutStatus:"+outStatus.Value.ToString()); if (result > 0) { //NetLog.WriteLoginHandler("宝付6","进入写入来源" ); AccountRechareInfo ar = null; lock (lockstatus) { ar = getAccountRechare(orderNo); } //1:PC if (null == ar) { Response.Write("您好,您的提交失败请重试!"); } ar.From = 5; //ar.CradNo = db.UserBasicInfo.FirstOrDefault(x => x.Id == userid).BankAccountNo; if (UpdateAccountRechare(ar) <= 0) { Response.Write("您好,您的提交失败请重试!"); return; } //NetLog.WriteLoginHandler("宝付7", "进入跳转"); var url = "/PaymentPlatform/Baofu/pay_post.aspx?orderno=" + orderNo + "&totalprice=" + Amount + "&PayID="; //NetLog.WriteLoginHandler("宝付8--跳转的URL", url); try { Response.Redirect(url, false); } catch (Exception ex) { SysLogHelper.WriteErrorLog("宝付9跳转错误", "错误详细信息:" + ex.Message + "|" + ex.StackTrace); } } else { Response.Write("您好,您的提交失败请重试!"); } }