Exemple #1
0
        /// <summary>
        /// 子商户注册
        /// </summary>
        /// <param name="cid"></param>
        /// <param name="UserId"></param>
        /// <param name="IdCard">身份证号码</param>
        /// <param name="RealName">真实姓名</param>
        /// <param name="BankName">银行名称</param>
        /// <param name="BankAccountNumber">银行卡号码</param>
        /// <param name="AreaCode">地区编码</param>
        /// <param name="BankCardPhoto">银行卡照片</param>
        /// <param name="IdCardPhoto">身份证照片</param>
        /// <param name="IdCardBackPhoto">身份证背面照片</param>
        /// <param name="PersonPhoto">三合一照片</param>
        /// <returns></returns>
        public string Register(int cid = 0, int UserId = 0, string IdCard = "", string RealName = "", string BankName = "", string BankAccountNumber = "", string AreaCode = "", int BankCardPhoto = 0, int IdCardPhoto = 0, int IdCardBackPhoto = 0, int PersonPhoto = 0)
        {
            //Thread.Sleep(3000);
            //return ApiReturnStr.getError(-100, "注册失败,测试终点");

            Logs.WriteLog($"Register,cid:{cid},UserId:{UserId},IdCard:{IdCard},RealName:{RealName},BankName:{BankName},BankAccountNumber:{BankAccountNumber},AreaCode:{AreaCode},BankCardPhoto:{BankCardPhoto},IdCardPhoto:{IdCardPhoto},IdCardBackPhoto:{IdCardBackPhoto},PersonPhoto:{PersonPhoto}", "d:\\Log\\Yeepay", "Register");
            if (UserId == 100103)
            {
                Thread.Sleep(3000);
                Users m = userDao.Single(UserId);
                m.IsRealState = 1;
                m.RealName    = "啊啊啊";
                userDao.Update(m);
                return(ApiReturnStr.getError(0, "开户成功"));
            }
            #region 参数验证
            if (UserId <= 0)
            {
                return(ApiReturnStr.getError(-100, "UserId参数错误"));
            }
            if (!RegexHelper.IsMatch(RealName, @"^\s*[\u4e00-\u9fa5]{1,}[\u4e00-\u9fa5.·]{0,15}[\u4e00-\u9fa5]{1,}\s*$"))
            {
                return(ApiReturnStr.getError(-100, "请输入真实的姓名!"));
            }
            if (!TypeParse.IsIdentity(IdCard))
            {
                return(ApiReturnStr.getError(-100, "身份证号格式错误!"));
            }
            if (!TypeParse.IsChinese(BankName))
            {
                return(ApiReturnStr.getError(-100, "银行卡开户行有误"));
            }
            if (string.IsNullOrEmpty(BankAccountNumber) || !(BankAccountNumber.Length > 13 && BankAccountNumber.Length < 21))
            {
                return(ApiReturnStr.getError(-100, "银行卡卡号有误"));
            }
            if (!BankCardBindHelper.ValidateBank(BankName, BankAccountNumber))
            {
                return(ApiReturnStr.getError(-100, "银行卡卡bin识别失败"));
            }
            if (string.IsNullOrEmpty(AreaCode) || AreaCode.Length != 4)
            {
                return(ApiReturnStr.getError(-100, "请选择地区码"));
            }
            if (BankCardPhoto == 0)
            {
                return(ApiReturnStr.getError(-100, "银行卡正面照未上传"));
            }
            if (IdCardPhoto == 0)
            {
                return(ApiReturnStr.getError(-100, "身份证正面照未上传"));
            }
            if (IdCardBackPhoto == 0)
            {
                return(ApiReturnStr.getError(-100, "身份证背面照未上传"));
            }
            if (PersonPhoto == 0)
            {
                PersonPhoto = IdCardPhoto;                 //取消手持三合一
            }
            var user = userDao.Single(" IdCard=@IdCard  and IsRealState=1", new { IdCard });
            if (user != null && user.UserId > 0)
            {
                return(ApiReturnStr.getError(-100, "该身份证号码已认证"));
            }

            var model = userDao.Single(UserId);
            if (model == null || model.UserId <= 0)
            {
                return(ApiReturnStr.getError(-100, "用户不存在"));
            }

            var cnt = yeepayLogDao.Count(string.Format("typeId={0} and UserId={1} and DateDiff(dd,CTime,getdate())=0 ", (int)YeepayType.子商户注册, UserId));
            if (cnt > 4)
            {
                return(ApiReturnStr.getError(-100, "当日开户次数超过5次,请次日再操作!"));
            }
            #endregion

            #region 组装子商户报文实体
            reqRegisterModel yeepayRegModel = new reqRegisterModel();
            yeepayRegModel.signedName        = RealName;
            yeepayRegModel.idCard            = IdCard;
            yeepayRegModel.bankAccountNumber = BankAccountNumber;
            yeepayRegModel.bankName          = BankName.ConvertBank();//转换易宝可识别的银行
            yeepayRegModel.areaCode          = AreaCode;

            #endregion
            //易宝子商户注册
            var result = YeepayDepository.Register(yeepayRegModel, UserId, cid, BankCardPhoto, IdCardPhoto, IdCardBackPhoto, PersonPhoto);
            //事件日志
            userEventDao.RealNameAuthentication(cid, UserId, Ip.GetClientIp(), IdCard, RealName, result.backState == 0 ? 1 : 0, TQuery.GetString("version"));
            return(ApiReturnStr.getError(result.backState, result.backState == 0 ? "开户成功" : result.message));
        }
Exemple #2
0
        public string ValidateBank()
        {
            var s = BankCardBindHelper.ValidateBank("招商银行1", "370286001882411");

            return(s.ToString());
        }