Esempio n. 1
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);
        }
Esempio n. 2
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();
        }
Esempio n. 3
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);
            }
        }