예제 #1
0
        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;
            }
        }
예제 #2
0
        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>");
            }
        }
예제 #3
0
        private BankCardBin GetBankCardBin_Old()
        {
            WebSettingInfo webSetting = new TuanDai.PortalSystem.DAL.WebSettingDAL().GetWebSettingInfo("E27798C9-9301-4176-AC0B-6F3916F389EA");

            PartnerConfig partnerConfig = new PartnerConfig(webSetting.Param1Value, webSetting.Param2Value, webSetting.Param3Value, webSetting.Param5Value);

            string url = "https://yintong.com.cn/traderapi/bankcardquery.htm";

            SortedDictionary <string, string> sParaTemp = new SortedDictionary <string, string>();

            sParaTemp.Add("oid_partner", partnerConfig.OidPartner);
            sParaTemp.Add("sign_type", "RSA");
            sParaTemp.Add("card_no", userModel.BankAccountNo);
            sParaTemp.Add("pay_type", "D");
            sParaTemp.Add("flag_amt_limit", "1");

            string strb = "";

            foreach (var item in sParaTemp)
            {
                if (strb == "")
                {
                    strb = item.Key + "=" + item.Value;
                }
                else
                {
                    strb += "&" + item.Key + "=" + item.Value;
                }
            }
            string       req_data = strb;
            String       sign     = LLPay.RSAFromPkcs8.sign(req_data, partnerConfig.TraderPriKey, "utf-8");
            BankCardInfo info     = new BankCardInfo();

            info.oid_partner    = partnerConfig.OidPartner;
            info.sign_type      = "RSA";
            info.sign           = sign;
            info.card_no        = userModel.BankAccountNo;
            info.pay_type       = "D";
            info.flag_amt_limit = "1";

            SysLogHelper.WriteTraceLog("连连查询银行卡BIN报文", strb);

            string      json     = Tool.HttpUtils.HttpPost(url, Newtonsoft.Json.JsonConvert.SerializeObject(info));
            BankCardBin bankcard = new BankCardBin();

            bankcard = Newtonsoft.Json.JsonConvert.DeserializeObject <BankCardBin>(json);

            if (bankcard == null)
            {
                bankcard = new BankCardBin();
            }
            if (bankcard.single_amt.ToText().IsEmpty())
            {
                bankcard.single_amt = "0";
            }
            if (bankcard.day_amt.ToText().IsEmpty())
            {
                bankcard.day_amt = "0";
            }
            return(bankcard);
        }
예제 #4
0
        protected void OnInitData()
        {
            UserBankInfo ubi = new UserBankInfo();
            UserBLL      bll = new UserBLL();

            userModel = bll.GetUserBasicInfoModelById(userId);
            var javaBankService = new BankFromJavaService();

            if (!GlobalUtils.IsOpenCGT)
            {
                if (string.IsNullOrEmpty(userModel.BankAccountNo))
                {
                    string sql = @"SELECT BankNo,BankType FROM dbo.UserBankInfo WITH(NOLOCK) WHERE UserId = @UserId ";

                    DynamicParameters para = new DynamicParameters();
                    para.Add("@UserId", userId);
                    ubi = PublicConn.QuerySingle <UserBankInfo>(sql, ref para);

                    if (ubi != null)
                    {
                        userModel.BankAccountNo = ubi.BankNo;
                        userModel.BankType      = ubi.BankType;
                    }
                }
            }
            else
            {
                if (GlobalUtils.IsBankService)
                {
                    bankInfoFromJava = javaBankService.GetBankInfo(userId, ServiceType.TuoMin);
                    if (bankInfoFromJava != null && bankInfoFromJava.respData != null)
                    {
                        bankName = bankInfoFromJava.respData.bankName;
                        bankNo   = bankInfoFromJava.respData.bankNo;
                    }
                }

                if (string.IsNullOrEmpty(bankNo))
                {
                    GlobalUtils.GetBankImg(userModel.Id, out bankName);
                    bankNo = userModel.BankAccountNo;
                }
            }
            vailStatus = getVailStatusByUserModel(userModel);
            this.IsValidateIdentity = userModel.IsValidateIdentity;
            if (GlobalUtils.IsBankService)
            {
                AviMoney = javaBankService.GetAviMoney(userId);
            }
            else
            {
                AviMoney = bll.GetUserAviMoney(userId);
            }


            bank = GetSupportBank();

            if (!GlobalUtils.IsOpenCGT)
            {
                string sType = WEBRequest.GetString("selectType");
                if (sType == "")
                {
                    //获取默认支付方式
                    if (GlobalUtils.IsWeiXinBrowser)
                    {
                        if (userModel.BankAccountNo.ToText().IsEmpty())
                        {
                            DefPayType = 1;
                        }
                        else
                        {
                            DefPayType = 2;
                        }
                    }
                    else
                    {
                        DefPayType = 2;
                    }
                }
                //判断openid为空时,重新授权
                if (GlobalUtils.IsWeiXinBrowser)
                {
                    if (GlobalUtils.OpenId.IsEmpty())
                    {
                        string strOpenId = TuanDai.WXApiWeb.Common.WeiXinApi.GetUserWXOpenId(userModel.Id);
                        if (strOpenId.IsNotEmpty())
                        {
                            GlobalUtils.WriteOpenIdToCookie(strOpenId.ToText());
                        }
                        else
                        {
                            TuanDai.WXApiWeb.Common.WeiXinApi wxApi = new Common.WeiXinApi();
                            wxApi.GetOpenidAndAccessToken(this);
                        }
                    }
                }
            }
            WebSettingInfo rechargeSet = new TuanDai.PortalSystem.DAL.WebSettingDAL().GetWebSettingInfo("9A89CBAE-6550-4EA1-8224-EB645F38F8FA");

            MinRechargeAmount = decimal.Parse(rechargeSet.Param1Value);

            this.CheckUseKuaiJiePay();
        }
예제 #5
0
        private BankCardBin GetSupportBank()
        {
            BankCardBin bindCard = new BankCardBin();

            bindCard.single_amt = "0";
            bindCard.day_amt    = "0";
            try
            {
                WebSettingInfo webSetting = new TuanDai.PortalSystem.DAL.WebSettingDAL().GetWebSettingInfo("E27798C9-9301-4176-AC0B-6F3916F389EA");

                SortedDictionary <string, string> sParaTemp = new SortedDictionary <string, string>();
                sParaTemp.Add("oid_partner", webSetting.Param1Value.Trim());
                sParaTemp.Add("api_version", "1.0");
                sParaTemp.Add("sign_type", "RSA");
                sParaTemp.Add("product_type", "1");
                sParaTemp.Add("pay_chnl", "10");

                var sign = PaymentUtil.AddSign(sParaTemp, webSetting.Param3Value, webSetting.Param2Value);
                sParaTemp.Add("sign", sign);
                var reqJson = PaymentUtil.DictToJson(sParaTemp);

                var url = "https://yintong.com.cn/queryapi/supportbankquery.htm";

                string           json           = postJson(url, reqJson);
                SupportBankQuery responseResult = new SupportBankQuery();
                responseResult = Newtonsoft.Json.JsonConvert.DeserializeObject <SupportBankQuery>(json);

                //记录充值请求参数
                // BusinessDll.NetLog.WriteBatchwithdrawHandler("记录连连支付银行卡卡bin查询", "请求报文:" + reqJson + ";返回报文" + json, "触屏版");
                if (responseResult == null)
                {
                    responseResult = new SupportBankQuery();
                }
                if (responseResult.ret_code == "0000")
                {
                    var sqlParamBankCode = new Dapper.DynamicParameters();
                    sqlParamBankCode.Add("@bankType", userModel.BankType);
                    var sqlBankCode = @"select BankCode,BankDesc from [dbo].[Bank_Code] with(nolock) where bankType=@bankType";
                    var bank_code   = TuanDai.DB.TuanDaiDB.QueryFirstOrDefault <Bank_Code>(TdConfig.DBRead, sqlBankCode,
                                                                                           ref sqlParamBankCode);
                    var backCode = string.Empty;
                    if (bank_code != null)
                    {
                        bindCard.BankDesc = bank_code.BankDesc;
                        backCode          = bank_code.BankCode;
                    }

                    backCode = string.IsNullOrEmpty(backCode) ? string.Empty : backCode.Trim();

                    var _supportBank = responseResult.support_banklist.FirstOrDefault(x => x.bank_code == backCode);
                    if (null != _supportBank)
                    {
                        bindCard.single_amt = _supportBank.single_amt;
                        bindCard.day_amt    = _supportBank.day_amt;
                        if (_supportBank.bank_status == "0")
                        {
                            bindCard.IsBankMaintain = false;
                        }
                        else
                        {
                            bindCard.IsBankMaintain = true;
                        }
                    }
                }
                if (decimal.Parse(bindCard.single_amt) >= 10000)
                {
                    bindCard.SingleAmt = (decimal.Parse(bindCard.single_amt) / 10000).ToString("n0") + "万";
                }
                else
                {
                    bindCard.SingleAmt = decimal.Parse(bindCard.single_amt).ToString("n0") + "元";
                }

                if (decimal.Parse(bindCard.day_amt) >= 10000)
                {
                    bindCard.DayAmt = (decimal.Parse(bindCard.day_amt) / 10000).ToString("n0") + "万";
                }
                else
                {
                    bindCard.DayAmt = decimal.Parse(bindCard.day_amt).ToString("n0") + "元";
                }

                return(bindCard);
            }
            catch (Exception ex) {
                // BusinessDll.NetLog.WriteLoginHandler("查询卡限额时出错", Tool.ExceptionHelper.GetExceptionMessage(ex), "触屏版");
                bindCard.IsBankMaintain = true;
                return(bindCard);
            }
        }