示例#1
0
    public AccountBasePage()
    {
        //
        // TODO: 在此处添加构造函数逻辑
        //
        BesttoneAccountDAO _besttoneAccount_dao = new BesttoneAccountDAO();
        BesttoneAccount _besttoneAccount_entity = _besttoneAccount_dao.QueryByCustID(base.CustID);
        if (_besttoneAccount_entity == null)
        {
            String SPTokenRequestValue = HttpContext.Current.Request["SPTokenRequest"] == null ? String.Empty : HttpContext.Current.Request["SPTokenRequest"];
            if (!String.IsNullOrEmpty(SPTokenRequestValue))
                HttpContext.Current.Response.Redirect("AccountNotBind.aspx?SPTokenRequest=" + HttpUtility.UrlEncode(SPTokenRequestValue));
            else
                HttpContext.Current.Response.Redirect("AccountNotBind.aspx");

            return;
        }
        else
        {
            this._bestPayAccount = _besttoneAccount_entity.BestPayAccount;
        }
        //解析参数
        ParseSPTokenRequest();
    }
示例#2
0
    /// <summary>
    /// 卡充值
    /// </summary>
    protected String AccountRechargeByCard(out StringBuilder strLog)
    {
        Int32 Result = ErrorDefinition.CIP_IError_Result_UnknowError_Code;
        String ErrMsg = ErrorDefinition.CIP_IError_Result_UnknowError_Msg;

        strLog = new StringBuilder();
        strLog.AppendFormat("【消费卡充值,DateTime:{0}】\r\n[参数]:", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));

        //获取参数
        String spid = Request["SPID"];
        String custid = Request["CustID"];
        String cardNo = Request["CardNo"];
        String cardPwd = Request["CardPassword"];
        String cardType = Request["CardType"];
        strLog.AppendFormat("SPID:{0},CustID:{1},CardNo:{2},CardPwd:{3},CardType:{4}\r\n", spid, custid, cardNo, cardPwd, cardType);

        //String CheckCardErrMsg = "";
        //Int32 CheckCardResult = BesttoneAccountHelper.VerifyCardNo(cardNo, out CheckCardErrMsg);
        //if(CheckCardResult!=0)
        //    return "[{\"result\":\"false\",\"step\":\"query\",\"errorcode\":\"" + CheckCardResult + "\",\"info\":\"" + CheckCardErrMsg + "}]";

        long accountBalance = 0;        //账户余额
        long cardBalance = 0;           //卡余额
        String accountType = BesttoneAccountHelper.ConvertAccountType(cardType);            //转换卡类型
        /*********************************************查询账户信息*****************************************************/
        BesttoneAccountDAO _besttoneAccount_dao = new BesttoneAccountDAO();
        BesttoneAccount account_entity = _besttoneAccount_dao.QueryByCustID(custid);

        #region 卡余额查询

        //查询卡余额
        Result = BesttoneAccountHelper.QueryCardBalance(cardNo, accountType, out cardBalance, out ErrMsg);
        strLog.AppendFormat("[查询卡余额]:Result:{0},Balance:{1}\r\n", Result, cardBalance);

        //查询失败
        if (Result != 0)
            return "[{\"result\":\"false\",\"step\":\"query\",\"errorcode\":\"" + Result + "\",\"info\":\"查询余额失败\"}]";

        //卡余额为0
        if (cardBalance == 0)
            return "[{\"result\":\"false\",\"step\":\"query\",\"errorcode\":\"200020\",\"info\":\"卡内余额为0\"}]";

        #endregion

        #region 账户充值金额上限校验

        long OnceRechargeLimit = BesttoneAccountConstDefinition.DefaultInstance.AccountRechargeLimitedOne;              //单笔充值金额上限
        long RechargeAmountLimit = BesttoneAccountConstDefinition.DefaultInstance.AccountRechargeLimitedDay;            //账户单日充值额度上限
        long CurrentAmountLimit = BesttoneAccountConstDefinition.DefaultInstance.AccountBalanceLimited;                 //账户余额上限
        if (OnceRechargeLimit > 0)
        {
            //检测用户单笔充值金额是否超限(10000元)
            if (cardBalance > OnceRechargeLimit)
                return "[{\"result\":\"false\",\"step\":\"query\",\"errorcode\":\"100003\",\"rechargeamount\":\"" + BesttoneAccountHelper.ConvertAmountToYuan(cardBalance) + "\",\"rechargeamountlimit\":\"" + BesttoneAccountHelper.ConvertAmountToYuan(OnceRechargeLimit) + "\",\"info\":\"卡内余额为0\"}]";
        }
        if (RechargeAmountLimit > 0)
        {
            //检测用户当日充值是否超限(当日充值金额不能超过50000元)
            long hadRechargeAmount = _rechargeOrder_dao.QueryCurrentRechargeAmount(account_entity.BestPayAccount);
            if ((hadRechargeAmount + cardBalance) > RechargeAmountLimit)
                return "[{\"result\":\"false\",\"step\":\"query\",\"errorcode\":\"100001\",\"rechargeamount\":\"" + BesttoneAccountHelper.ConvertAmountToYuan(hadRechargeAmount) + "\",\"rechargeamountlimit\":\"" + BesttoneAccountHelper.ConvertAmountToYuan(RechargeAmountLimit) + "\",\"info\":\"卡内余额为0\"}]";
        }

        if (CurrentAmountLimit > 0)
        {
            //检测用户帐户余额(个人账户余额不能超过100000元)
            Result = BesttoneAccountHelper.QueryAccountBalance(account_entity.BestPayAccount, out accountBalance, out ErrMsg);
            if (Result != 0)
                return "[{\"result\":\"false\",\"step\":\"query\",\"errorcode\":\"" + Result + "\",\"info\":\"账户信息查询失败\"}]";

            if ((accountBalance + cardBalance) > CurrentAmountLimit)
                return "[{\"result\":\"false\",\"step\":\"query\",\"errorcode\":\"100002\",\"accountbalance\":\"" + BesttoneAccountHelper.ConvertAmountToYuan(accountBalance) + "\",\"CurrentAmountLimit\":\"" + BesttoneAccountHelper.ConvertAmountToYuan(CurrentAmountLimit) + "\",\"info\":\"卡内余额为0\"}]";
            accountBalance = 0;
        }

        #endregion

        #region 卡扣款

        String transactionID = BesttoneAccountHelper.CreateTransactionID();
        String orderSeq = BesttoneAccountHelper.CreateOrderSeq();
        DateTime reqTime = DateTime.Now;

        RechargeOrder _recharge_order;              //充值订单
        CardRechargeRecord cardrecharge_entity;     //卡扣款流水记录

        //初始化充值订单
        _recharge_order = new RechargeOrder(orderSeq, transactionID, reqTime.ToString("yyyyMMdd"), "RMB", cardBalance, cardBalance, 0, "消费卡向账户充值扣款",
            custid, account_entity.BestPayAccount, cardType, spid, reqTime, new DateTime(1900, 1, 1), new DateTime(1900, 1, 1), 1, 0, "", "", "","0");  //2013-04-13 add 最后一个字段 0 代表是否需要开票
        //初始化充值订单—测试
        //_recharge_order = new RechargeOrder(orderSeq, transactionID, reqTime.ToString("yyyyMMdd"), "RMB", 1, 1, 0, "消费卡向账户充值扣款",
        //    custid, account_entity.BestPayAccount, cardType, spid, reqTime, new DateTime(1900, 1, 1), new DateTime(1900, 1, 1), 1, 0, "", "", "");

        //初始化卡扣款流水
        cardrecharge_entity = new CardRechargeRecord(transactionID, orderSeq, reqTime.ToString("yyyyMMdd"), "RMB", cardBalance, "消费卡向账户充值扣款", cardNo, cardPwd, cardType,
            account_entity.BestPayAccount, 0, reqTime, new DateTime(1900, 1, 1), "", "", "", "", "");
        //初始化卡扣款流水—测试
        //cardrecharge_entity = new CardRechargeRecord(transactionID, orderSeq, reqTime.ToString("yyyyMMdd"), "RMB", 1, "消费卡向账户充值扣款", cardNo, cardPwd, cardType,
        //    account_entity.BestPayAccount, 0, reqTime, new DateTime(1900, 1, 1), "", "", "", "", "");

        strLog.AppendFormat("[订单信息]:TransactionID:{0},OrderSeq:{1},ReqTime:{2}\r\n", transactionID, orderSeq, reqTime.ToString("yyyy-MM-dd HH:mm:ss"));

        /***********************************************************开始扣款*******************************************************/
        String uptranSeq = String.Empty;                        //交易流水号,支付平台返回的,后期对账用
        Result = BesttoneAccountHelper.CardDeductionBalance(transactionID, orderSeq, cardNo, cardPwd, cardType, cardBalance, reqTime, "", out uptranSeq, out ErrMsg);
        //扣款—测试
        //Result = BesttoneAccountHelper.CardDeductionBalance(transactionID, orderSeq, cardNo, cardPwd, cardType, 1, reqTime, "", out uptranSeq, out ErrMsg);
        strLog.AppendFormat("[卡扣款]:Result:{0},ErrMsg:{1}\r\n", Result, ErrMsg);
        _recharge_order.UptranSeq = uptranSeq;
        cardrecharge_entity.UptranSeq = uptranSeq;
        if (Result != 0)
        {
            //修改订单信息
            _recharge_order.Status = 4;     // 这里要对调网关发生异常做分别处理 ,定位6
            if (Result == -3024)
            {
                _recharge_order.Status = 6;
            }

            _recharge_order.PayTime = DateTime.Now;
            _recharge_order.ReturnCode = Result.ToString();
            _recharge_order.ReturnDesc = ErrMsg;
            _rechargeOrder_dao.Insert(_recharge_order);

            //修改卡扣款记录信息
            //cardrecharge_entity.Status = 2;   //为统一rechargeorder 和 cardrechargerecord 的状态值,这里做修改 2013-05-15
            cardrecharge_entity.Status = 4;
            if (Result == -3024)
            {
                cardrecharge_entity.Status = 6;
            }
            //以上和rechargeorder 的状态处理方式统一

            cardrecharge_entity.PayTime = DateTime.Now;
            cardrecharge_entity.ReturnCode = Result.ToString();
            cardrecharge_entity.ReturnDesc = ErrMsg;
            _cardRechargeRecord_dao.Insert(cardrecharge_entity);
            return "[{\"result\":\"false\",\"step\":\"deduction\",\"errorcode\":\"" + Result + "\",\"info\":\"卡扣款失败\"}]";
        }
        else
        {
            //修改订单信息
            _recharge_order.Status = 2;
            _recharge_order.PayTime = DateTime.Now;
            _recharge_order.ReturnCode = "0000";
            _recharge_order.ReturnDesc = "已扣款待充值";   // 原:扣款成功
            _rechargeOrder_dao.Insert(_recharge_order);

            //修改卡充值记录信息
            //cardrecharge_entity.Status = 1;      // 这里为和 rechargeorder 状态统一 ,修改为2
            cardrecharge_entity.Status = 2;
            cardrecharge_entity.PayTime = DateTime.Now;
            cardrecharge_entity.ReturnCode = "0000";
            cardrecharge_entity.ReturnDesc = "已扣款待充值";   // 原:扣款成功
            _cardRechargeRecord_dao.Insert(cardrecharge_entity);
        }

        #endregion

        #region 充值

        transactionID = BesttoneAccountHelper.CreateTransactionID();        //充值流水记录
        DateTime rechargeTime = DateTime.Now;                               //充值请求时间
        String returnMsg = String.Empty;
        bool resultBoolean = false;

        //初始化充值流水类
        AccountRechargeRecord rechargeRecord_entity = new AccountRechargeRecord(transactionID, rechargeTime.ToString("yyyyMMdd"), orderSeq,
            cardBalance, cardType, "消费卡充值", rechargeTime, new DateTime(1900, 1, 1), 0, "", "");

        try
        {
            #region 开始充值

            //调用接口给账户充值
            Result = BesttoneAccountHelper.AccountRecharge(transactionID, account_entity.BestPayAccount, cardBalance, rechargeTime, out accountBalance, out ErrMsg);
            //调用接口给账户充值—测试
            //Result = BesttoneAccountHelper.AccountRecharge(transactionID, account_entity.BestPayAccount, 1, rechargeTime, out accountBalance, out ErrMsg);
            strLog.AppendFormat("[账户充值]:TransactionID:{0},Result:{1},ErrMsg:{2}\r\n", transactionID, Result, ErrMsg);
            if (Result == 0)
            {
                //修改订单信息
                _recharge_order = _rechargeOrder_dao.QueryByOrderSeq(orderSeq);
                _recharge_order.Status = 3;
                _recharge_order.RechargeCount = 1;
                _recharge_order.CompleteTime = DateTime.Now;
                _recharge_order.ReturnCode = "0000";
                _recharge_order.ReturnDesc = "已充值";    // 原:充值成功
                _recharge_order.RechargeTransactionID = transactionID;  // 回填充值流水号
                resultBoolean = _rechargeOrder_dao.Update(_recharge_order);

                //修改充值流水记录信息
                rechargeRecord_entity.Status = 3;    // 原: 1 ,为和总表rechargeorder 统一改为3
                rechargeRecord_entity.CompleteTime = DateTime.Now;
                rechargeRecord_entity.ReturnCode = "0000";
                rechargeRecord_entity.ReturnDesc = "已充值";  // 原:充值成功

                strLog.AppendFormat("[更新订单状态]ResultBoolean:{0}\r\n", resultBoolean);
                returnMsg = "[{\"result\":\"true\",\"info\":\"账户充值成功\",\"deductionBalance\":\"" + BesttoneAccountHelper.ConvertAmountToYuan(cardBalance) + "\",\"accountBalance\":\"" + BesttoneAccountHelper.ConvertAmountToYuan(accountBalance) + "\"}]";
            }
            else
            {
                //修改订单信息
                _recharge_order = _rechargeOrder_dao.QueryByOrderSeq(orderSeq);
                _recharge_order.RechargeCount = 1;
                _recharge_order.Status = 5; // 原:没有这句
                if (Result == -3025)
                {
                    _recharge_order.Status = 7;  //原:没有这句
                }
                _recharge_order.ReturnCode = Result.ToString();
                _recharge_order.ReturnDesc = ErrMsg;
                _recharge_order.RechargeTransactionID = transactionID;  // 回填充值流水号
                resultBoolean = _rechargeOrder_dao.Update(_recharge_order);

                //修改充值流水记录信息
                rechargeRecord_entity.Status = 5;    //   5 代表充值失败  原:2

                if (Result == -3025)
                {
                    rechargeRecord_entity.Status = 7;// 充值异常
                }
                rechargeRecord_entity.CompleteTime = DateTime.Now;
                rechargeRecord_entity.ReturnCode = Result.ToString();
                rechargeRecord_entity.ReturnDesc = ErrMsg;

                returnMsg = "[{\"result\":\"false\",\"step\":\"recharge\",\"errorcode\":\"" + Result + "\",\"info\":\"账户充值失败\"}]";
            }

            #endregion
        }
        catch (Exception ex)
        {
            rechargeRecord_entity.ReturnDesc += ex.Message;
            throw ex;
        }
        finally
        {
            _accountRechargeRecord_dao.Insert(rechargeRecord_entity);
        }

        #endregion

        return returnMsg;
    }
示例#3
0
    public String ResetPayPassWord(String SPID,String CustID,String wt)
    {
        StringBuilder ResponseMsg = new StringBuilder();

        Int32 Result = ErrorDefinition.CIP_IError_Result_UnknowError_Code;
        String ErrMsg = ErrorDefinition.CIP_IError_Result_UnknowError_Msg;

        #region

        if (CommonUtility.IsEmpty(SPID))
        {
            // 返回错误信息
            ResponseMsg.Length = 0;
            if ("json".Equals(wt))
            {
                ResponseMsg.Append("{");
                ResponseMsg.AppendFormat("\"errcode\":\"{0}\",", "995");
                ResponseMsg.AppendFormat("\"errmsg\":\"{0}\"", "SPID不能为空!");
                ResponseMsg.Append("}");
            }
            else
            {
                ResponseMsg.Append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
                ResponseMsg.Append("<PayPlatRequestParameter>");
                ResponseMsg.Append("<PARAMETERS>");
                ResponseMsg.AppendFormat("<ErrCode>{0}</ErrCode>", "995");
                ResponseMsg.AppendFormat("<ErrMsg>{0}</ErrMsg>", "SPID不能为空!");
                ResponseMsg.Append("</PARAMETERS>");
                ResponseMsg.Append("</PayPlatRequestParameter>");
            }
            return ResponseMsg.ToString();
        }

        if (CommonUtility.IsEmpty(CustID))
        {
            // 返回错误信息
            ResponseMsg.Length = 0;
            if ("json".Equals(wt))
            {
                ResponseMsg.Append("{");
                ResponseMsg.AppendFormat("\"errcode\":\"{0}\",", "996");
                ResponseMsg.AppendFormat("\"errmsg\":\"{0}\"", "CustID不能为空!");
                ResponseMsg.Append("}");
            }
            else
            {
                ResponseMsg.Append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
                ResponseMsg.Append("<PayPlatRequestParameter>");
                ResponseMsg.Append("<PARAMETERS>");
                ResponseMsg.AppendFormat("<ErrCode>{0}</ErrCode>", "996");
                ResponseMsg.AppendFormat("<ErrMsg>{0}</ErrMsg>", "CustID不能为空!");
                ResponseMsg.Append("</PARAMETERS>");
                ResponseMsg.Append("</PayPlatRequestParameter>");
            }
            return ResponseMsg.ToString();
        }

        String Phone = String.Empty;
        BesttoneAccount account = null;
        BesttoneAccountDAO dao = new BesttoneAccountDAO();
        account = dao.QueryByCustID(CustID);
        if (account != null)
        {
            Phone = account.BestPayAccount;
        }
        else
        {
            //未开户
            // 返回错误信息
            ResponseMsg.Length = 0;
            if ("json".Equals(wt))
            {
                ResponseMsg.Append("{");
                ResponseMsg.AppendFormat("\"errcode\":\"{0}\",", "997");
                ResponseMsg.AppendFormat("\"errmsg\":\"{0}\"", "该CustID尚未开户!");
                ResponseMsg.Append("}");
            }
            else
            {
                ResponseMsg.Append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
                ResponseMsg.Append("<PayPlatRequestParameter>");
                ResponseMsg.Append("<PARAMETERS>");
                ResponseMsg.AppendFormat("<ErrCode>{0}</ErrCode>", "997");
                ResponseMsg.AppendFormat("<ErrMsg>{0}</ErrMsg>", "该CustID尚未开户!");
                ResponseMsg.Append("</PARAMETERS>");
                ResponseMsg.Append("</PayPlatRequestParameter>");
            }
            return ResponseMsg.ToString();
        }

        ////////验证码校验
        //////Result = PhoneBO.SelSendSMSMassage(CustID, Phone, AuthenCode, out ErrMsg);
        //////if (Result != 0)
        //////{
        //////    // 验证码未校验通过  return
        //////    ResponseMsg.Length = 0;
        //////    if ("json".Equals(wt))
        //////    {
        //////        ResponseMsg.Append("{");
        //////        ResponseMsg.AppendFormat("\"errcode\":\"{0}\",", "1000");
        //////        ResponseMsg.AppendFormat("\"errmsg\":\"{0}\"", "验证码未校验通过!");
        //////        ResponseMsg.Append("}");
        //////    }
        //////    else
        //////    {
        //////        ResponseMsg.Append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
        //////        ResponseMsg.Append("<PayPlatRequestParameter>");
        //////        ResponseMsg.Append("<PARAMETERS>");
        //////        ResponseMsg.AppendFormat("<ErrCode>{0}</ErrCode>", "1000");
        //////        ResponseMsg.AppendFormat("<ErrMsg>{0}</ErrMsg>", "验证码未校验通过!");
        //////        ResponseMsg.Append("</PARAMETERS>");
        //////        ResponseMsg.Append("</PayPlatRequestParameter>");
        //////    }
        //////    return ResponseMsg.ToString();
        //////}

        String t_custid = PhoneBO.IsAuthenPhone(Phone, SPID, out ErrMsg);
            // t_custid 可以为空,但不能是别人的custid,可以为空是说明此客户无认证电话
        if (!String.IsNullOrEmpty(t_custid))
        {
            if (CustID != t_custid)
            {
                //是别人的手机号,不能用来开户  return
                ResponseMsg.Length = 0;
                if ("json".Equals(wt))
                {
                    ResponseMsg.Append("{");
                    ResponseMsg.AppendFormat("\"errcode\":\"{0}\",", "1000");
                    ResponseMsg.AppendFormat("\"errmsg\":\"{0}\"", Phone + "(" + CustID + ")是别人的手机号(" + t_custid + "),不能用来开户!");
                    ResponseMsg.Append("}");
                }
                else
                {
                    ResponseMsg.Append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
                    ResponseMsg.Append("<PayPlatRequestParameter>");
                    ResponseMsg.Append("<PARAMETERS>");
                    ResponseMsg.AppendFormat("<ErrCode>{0}</ErrCode>", "1000");
                    ResponseMsg.AppendFormat("<ErrMsg>{0}</ErrMsg>", "是别人的手机号,不能用来开户!");
                    ResponseMsg.Append("</PARAMETERS>");
                    ResponseMsg.Append("</PayPlatRequestParameter>");
                }
                return ResponseMsg.ToString();
            }

        }

        #endregion

        try
        {

            Linkage.BestTone.Interface.Rule.CustInfo custInfo = new Linkage.BestTone.Interface.Rule.CustInfo();
            int QueryCustInfoResult = QueryCustInfo(account.BestPayAccount, out custInfo, out ErrMsg);
            if (QueryCustInfoResult == 0)
            {
                Result = ResetBesttoneAccountPayPassword(account.BestPayAccount, custInfo.IdType, custInfo.IdNo, custInfo.CustomerName, out ErrMsg);
                if (Result == 0)
                {
                    ResponseMsg.Length = 0;
                    if ("json".Equals(wt))
                    {
                        ResponseMsg.Append("{");
                        ResponseMsg.AppendFormat("\"errcode\":\"{0}\",", "0");
                        ResponseMsg.AppendFormat("\"errmsg\":\"{0}\"", "密码重置成功!");
                        ResponseMsg.Append("}");
                    }
                    else
                    {
                        ResponseMsg.Append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
                        ResponseMsg.Append("<PayPlatRequestParameter>");
                        ResponseMsg.Append("<PARAMETERS>");
                        ResponseMsg.AppendFormat("<ErrCode>{0}</ErrCode>", "0");
                        ResponseMsg.AppendFormat("<ErrMsg>{0}</ErrMsg>", "密码重置成功!");
                        ResponseMsg.Append("</PARAMETERS>");
                        ResponseMsg.Append("</PayPlatRequestParameter>");
                    }
                    return ResponseMsg.ToString();

                }
                else
                {
                    //ReturnCode = Convert.ToString(ErrorDefinition.BT_IError_Result_BizInterfaceLimit_Code);
                    //Descriptioin = "重置密码失败!";  失败  return
                    ResponseMsg.Length = 0;
                    if ("json".Equals(wt))
                    {
                        ResponseMsg.Append("{");
                        ResponseMsg.AppendFormat("\"errcode\":\"{0}\",", "910");
                        ResponseMsg.AppendFormat("\"errmsg\":\"{0}\"", "密码重置失败!");
                        ResponseMsg.Append("}");
                    }
                    else
                    {
                        ResponseMsg.Append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
                        ResponseMsg.Append("<PayPlatRequestParameter>");
                        ResponseMsg.Append("<PARAMETERS>");
                        ResponseMsg.AppendFormat("<ErrCode>{0}</ErrCode>", "910");
                        ResponseMsg.AppendFormat("<ErrMsg>{0}</ErrMsg>", "密码重置失败!");
                        ResponseMsg.Append("</PARAMETERS>");
                        ResponseMsg.Append("</PayPlatRequestParameter>");
                    }
                    return ResponseMsg.ToString();
                }
            }
            else
            {
                ResponseMsg.Length = 0;
                if ("json".Equals(wt))
                {
                    ResponseMsg.Append("{");
                    ResponseMsg.AppendFormat("\"errcode\":\"{0}\",", "920");
                    ResponseMsg.AppendFormat("\"errmsg\":\"{0}\"", "无此账户!");
                    ResponseMsg.Append("}");
                }
                else
                {
                    ResponseMsg.Append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
                    ResponseMsg.Append("<PayPlatRequestParameter>");
                    ResponseMsg.Append("<PARAMETERS>");
                    ResponseMsg.AppendFormat("<ErrCode>{0}</ErrCode>", "920");
                    ResponseMsg.AppendFormat("<ErrMsg>{0}</ErrMsg>", "无此账户!");
                    ResponseMsg.Append("</PARAMETERS>");
                    ResponseMsg.Append("</PayPlatRequestParameter>");
                }
                return ResponseMsg.ToString();
            }

        }
        catch (Exception ecp)
        {
            ResponseMsg.Length = 0;
            if ("json".Equals(wt))
            {
                ResponseMsg.Append("{");
                ResponseMsg.AppendFormat("\"errcode\":\"{0}\",", "930");
                ResponseMsg.AppendFormat("\"errmsg\":\"{0}\"", ecp.ToString());
                ResponseMsg.Append("}");
            }
            else
            {
                ResponseMsg.Append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
                ResponseMsg.Append("<PayPlatRequestParameter>");
                ResponseMsg.Append("<PARAMETERS>");
                ResponseMsg.AppendFormat("<ErrCode>{0}</ErrCode>", "930");
                ResponseMsg.AppendFormat("<ErrMsg>{0}</ErrMsg>", ecp.ToString());
                ResponseMsg.Append("</PARAMETERS>");
                ResponseMsg.Append("</PayPlatRequestParameter>");
            }
            return ResponseMsg.ToString();
        }
        return ResponseMsg.ToString();
    }
示例#4
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            try
            {
                String custid = Request["hiddenCustID"];
                String spid = Request["hiddenSPID"];
                String InvoiceType = Request["InvoiceType"];
                String InvoiceTitle = Request["InvoiceTitle"];
                String InvoiceContent = Request["InvoiceContent"];
                String ContactPerson = Request["ContactPerson"];
                String ContactPhone = Request["ContactPhone"];
                String Address = Request["Address"];
                String Zip = Request["Zip"];
                String Mem = Request["Mem"];
                String NeedInvoice = Request["NeedInvoice"];

                long balance = Convert.ToInt64(Convert.ToDouble(Request["TranAmount"]) * 100);
                DateTime reqTime = DateTime.Now;

                //查询账户信息
                BesttoneAccountDAO _besttoneAccount_dao = new BesttoneAccountDAO();
                BesttoneAccount account_entity = _besttoneAccount_dao.QueryByCustID(custid);
                if (account_entity == null)
                {
                    CommonBizRules.ErrorHappenedRedircet(result, ErrMsg, "账户信息异常", this.Context);
                    return;
                }

                #region 账户充值金额上限校验

                long OnceRechargeLimit = BesttoneAccountConstDefinition.DefaultInstance.AccountRechargeLimitedOne;              //单笔充值金额上限
                long RechargeAmountLimit = BesttoneAccountConstDefinition.DefaultInstance.AccountRechargeLimitedDay;            //账户单日充值额度上限
                long CurrentAmountLimit = BesttoneAccountConstDefinition.DefaultInstance.AccountBalanceLimited;                 //账户余额上限
                if (OnceRechargeLimit > 0)
                {
                    //检测用户单笔充值金额是否超限(10000元)
                    if (balance > OnceRechargeLimit)
                    {
                        result = 100003;
                        ErrMsg = String.Format("单笔充值金额最多不能超过{0}元", BesttoneAccountHelper.ConvertAmountToYuan(OnceRechargeLimit));
                        CommonBizRules.ErrorHappenedRedircet(result, ErrMsg, "充值金额超过上限", this.Context);
                        return;
                    }
                }
                if (RechargeAmountLimit > 0)
                {
                    //检测用户当日充值是否超限(当日充值金额不能超过50000元)
                    long hadRechargeAmount = _rechargeOrder_dao.QueryCurrentRechargeAmount(account_entity.BestPayAccount);
                    if ((hadRechargeAmount + balance) > RechargeAmountLimit)
                    {
                        result = 100001;
                        ErrMsg = String.Format("您今日累计充值金额:{0}元,本次充值将超过您的当日累计充值限额:{1}元,请改日再进行充值操作!",
                            BesttoneAccountHelper.ConvertAmountToYuan(hadRechargeAmount), BesttoneAccountHelper.ConvertAmountToYuan(RechargeAmountLimit));
                        CommonBizRules.ErrorHappenedRedircet(result, ErrMsg, "充值金额超过上限", this.Context);
                        return;
                    }
                }

                if (CurrentAmountLimit > 0)
                {
                    long accountBalance = 0;
                    //检测用户帐户余额(个人账户余额不能超过100000元)
                    result = BesttoneAccountHelper.QueryAccountBalance(account_entity.BestPayAccount, out accountBalance, out ErrMsg);
                    if (result != 0)
                    {
                        CommonBizRules.ErrorHappenedRedircet(result, ErrMsg, "账户信息异常", this.Context);
                        return;
                    }

                    if ((accountBalance + balance) > CurrentAmountLimit)
                    {
                        result = 100002;
                        ErrMsg = String.Format("您的账户余额为:{0}元,本次充值将超过您的账户余额上限:{1}元,请消费后再进行充值操作!",
                            BesttoneAccountHelper.ConvertAmountToYuan(accountBalance), BesttoneAccountHelper.ConvertAmountToYuan(CurrentAmountLimit));
                        CommonBizRules.ErrorHappenedRedircet(result, ErrMsg, "充值金额超过上限", this.Context);
                        return;
                    }
                }

                #endregion

                bool Result = false;

                #region 生成订单信息

                /***************************************************************************/
                String orderSeq = BesttoneAccountHelper.CreateOrderSeq();                   //订单号
                String transactionID = BesttoneAccountHelper.CreateTransactionID();         //流水号
                // 在发起网银扣款请求,主表状态为1,扣款子表状态为0
                //初始化充值订单
                //2013-04-13 add -start
                if (String.IsNullOrEmpty(NeedInvoice))
                {
                    NeedInvoice = "0";
                }
                //2013-04-13 add -end
                RechargeOrder _recharge_order = new RechargeOrder(orderSeq, transactionID, reqTime.ToString("yyyyMMdd"), "RMB",
                    balance, balance, 0, "网银充值", custid, account_entity.BestPayAccount, "0", spid, reqTime, new DateTime(1900, 1, 1),
                    new DateTime(1900, 1, 1), 1, 0, "", "", "", NeedInvoice);  //2013-04-13 add NeedInvoice 字段

                //初始化网银扣款流水记录
                BankRechargeRecord _bankRecharge_record = new BankRechargeRecord(orderSeq, transactionID, reqTime.ToString("yyyyMMdd"), "RMB",
                    balance, balance, 0, "网银充值", account_entity.BestPayAccount, 0, reqTime, new DateTime(1900, 1, 1), "", "", "", "", "");

                Result = _rechargeOrder_dao.Insert(_recharge_order);
                if (!Result)
                {
                    CommonBizRules.ErrorHappenedRedircet(result, ErrMsg, "网银充值失败1", this.Context);
                    return;
                }

                //如果需要开发票 -- 插入发票表  2013-04-14 add-start
                if ("1".Equals(NeedInvoice))
                {
                    System.Text.StringBuilder datalog = new System.Text.StringBuilder();
                    //Result = _rechargeOrder_dao.InsertInvoice(orderSeq, InvoiceType, "", InvoiceTitle, ContactPerson, ContactPhone, Address, Zip, Mem, out datalog);
                    if ("0".Equals("InvoiceType"))
                    {
                        InvoiceTitle = "个人";
                    }
                    if (String.IsNullOrEmpty(InvoiceTitle))
                    {
                        InvoiceTitle = "个人";
                    }
                    if (String.IsNullOrEmpty(InvoiceContent))
                    {
                        InvoiceContent = "日用品";
                    }
                    Result = _rechargeOrder_dao.InsertInvoice(orderSeq, InvoiceType, InvoiceContent, InvoiceTitle, ContactPerson, ContactPhone, Address, Zip, Mem,"9", out datalog);  // "9" 代表需要开票
                    if (!Result)
                    {
                        CommonBizRules.ErrorHappenedRedircet(result, ErrMsg, "网银充值失败-发票生成失败", this.Context);
                        return;
                    }
                }
                //2013-04-14 add-end

                Result = _bankRechargeRecord_dao.Insert(_bankRecharge_record);
                if (!Result)
                {
                    CommonBizRules.ErrorHappenedRedircet(result, ErrMsg, "网银充值失败2", this.Context);
                    return;
                }
                /***************************************************************************/

                #endregion

                this._ORDERSEQ = orderSeq;
                this._ORDERREQTRANSEQ = transactionID;
                this._ORDERDATE = reqTime.ToString("yyyyMMddHHmmss");
                this._ORDERAMOUNT = balance.ToString();
                this._PRODUCTAMOUNT = balance.ToString();

                //MAC签名
                String mac = String.Format("MERCHANTID={0}&ORDERSEQ={1}&ORDERDATE={2}&ORDERAMOUNT={3}", this.MERCHANTID, this._ORDERSEQ, this._ORDERDATE, this._ORDERAMOUNT);
                mac = BesttoneAccountHelper.MACSign(mac);

                this._MAC = mac;
            }
            catch (Exception ex)
            {
                CommonBizRules.ErrorHappenedRedircet(result, ErrMsg, "网银充值失败", this.Context);
                return;
            }
        }
    }
    /// <summary>
    /// 
    /// </summary>
    /// <param name="SPID"></param>
    /// <param name="CustID"></param>
    /// <param name="Phone"></param>
    /// <param name="CheckPhoneCode"></param>
    /// <param name="wt"></param>
    /// <returns></returns>
    public String OpenBesttoneAccount(String SPID, String CustID, String Phone, String IDCard, String RealName, String ContactTel, String Email, String Sex,String AuthenCode, String wt)
    {
        //返回参数
        String ErrMsg = String.Empty;
        Int32 Result = ErrorDefinition.CIP_IError_Result_UnknowError_Code;

        StringBuilder ResponseMsg = new StringBuilder();

        if (CommonUtility.IsEmpty(SPID))
        {
            // 返回错误信息
            ResponseMsg.Length = 0;
            if ("json".Equals(wt))
            {
                ResponseMsg.Append("{");
                ResponseMsg.AppendFormat("\"errcode\":\"{0}\",", "995");
                ResponseMsg.AppendFormat("\"errmsg\":\"{0}\"", "SPID不能为空!");
                ResponseMsg.Append("}");
            }
            else
            {
                ResponseMsg.Append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
                ResponseMsg.Append("<PayPlatRequestParameter>");
                ResponseMsg.Append("<PARAMETERS>");
                ResponseMsg.AppendFormat("<ErrCode>{0}</ErrCode>", "995");
                ResponseMsg.AppendFormat("<ErrMsg>{0}</ErrMsg>", "SPID不能为空!");
                ResponseMsg.Append("</PARAMETERS>");
                ResponseMsg.Append("</PayPlatRequestParameter>");
            }
            return ResponseMsg.ToString();
        }

        if (CommonUtility.IsEmpty(CustID))
        {
            // 返回错误信息
            ResponseMsg.Length = 0;
            if ("json".Equals(wt))
            {
                ResponseMsg.Append("{");
                ResponseMsg.AppendFormat("\"errcode\":\"{0}\",", "996");
                ResponseMsg.AppendFormat("\"errmsg\":\"{0}\"", "CustID不能为空!");
                ResponseMsg.Append("}");
            }
            else
            {
                ResponseMsg.Append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
                ResponseMsg.Append("<PayPlatRequestParameter>");
                ResponseMsg.Append("<PARAMETERS>");
                ResponseMsg.AppendFormat("<ErrCode>{0}</ErrCode>", "996");
                ResponseMsg.AppendFormat("<ErrMsg>{0}</ErrMsg>", "CustID不能为空!");
                ResponseMsg.Append("</PARAMETERS>");
                ResponseMsg.Append("</PayPlatRequestParameter>");
            }
            return ResponseMsg.ToString();
        }

        if (CommonUtility.IsEmpty(Phone))
        {
            // 返回错误信息
            ResponseMsg.Length = 0;
            if ("json".Equals(wt))
            {
                ResponseMsg.Append("{");
                ResponseMsg.AppendFormat("\"errcode\":\"{0}\",", "997");
                ResponseMsg.AppendFormat("\"errmsg\":\"{0}\"", "Phone不能为空!");
                ResponseMsg.Append("}");
            }
            else
            {
                ResponseMsg.Append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
                ResponseMsg.Append("<PayPlatRequestParameter>");
                ResponseMsg.Append("<PARAMETERS>");
                ResponseMsg.AppendFormat("<ErrCode>{0}</ErrCode>", "997");
                ResponseMsg.AppendFormat("<ErrMsg>{0}</ErrMsg>", "Phone不能为空!");
                ResponseMsg.Append("</PARAMETERS>");
                ResponseMsg.Append("</PayPlatRequestParameter>");
            }
            return ResponseMsg.ToString();
        }

        if (CommonUtility.IsEmpty(IDCard))
        {
            // 返回错误信息
            ResponseMsg.Length = 0;
            if ("json".Equals(wt))
            {
                ResponseMsg.Append("{");
                ResponseMsg.AppendFormat("\"errcode\":\"{0}\",", "998");
                ResponseMsg.AppendFormat("\"errmsg\":\"{0}\"", "IDCard不能为空!");
                ResponseMsg.Append("}");
            }
            else
            {
                ResponseMsg.Append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
                ResponseMsg.Append("<PayPlatRequestParameter>");
                ResponseMsg.Append("<PARAMETERS>");
                ResponseMsg.AppendFormat("<ErrCode>{0}</ErrCode>", "998");
                ResponseMsg.AppendFormat("<ErrMsg>{0}</ErrMsg>", "IDCard不能为空!");
                ResponseMsg.Append("</PARAMETERS>");
                ResponseMsg.Append("</PayPlatRequestParameter>");
            }
            return ResponseMsg.ToString();
        }

        if (CommonUtility.IsEmpty(RealName))
        {
            // 返回错误信息
            ResponseMsg.Length = 0;
            if ("json".Equals(wt))
            {
                ResponseMsg.Append("{");
                ResponseMsg.AppendFormat("\"errcode\":\"{0}\",", "999");
                ResponseMsg.AppendFormat("\"errmsg\":\"{0}\"", "RealName不能为空!");
                ResponseMsg.Append("}");
            }
            else
            {
                ResponseMsg.Append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
                ResponseMsg.Append("<PayPlatRequestParameter>");
                ResponseMsg.Append("<PARAMETERS>");
                ResponseMsg.AppendFormat("<ErrCode>{0}</ErrCode>", "999");
                ResponseMsg.AppendFormat("<ErrMsg>{0}</ErrMsg>", "RealName不能为空!");
                ResponseMsg.Append("</PARAMETERS>");
                ResponseMsg.Append("</PayPlatRequestParameter>");
            }
            return ResponseMsg.ToString();
        }

        //验证码校验
        Result = PhoneBO.SelSendSMSMassage(CustID, Phone, AuthenCode, out ErrMsg);
        if (Result != 0)
        {
            // 验证码未校验通过  return
            ResponseMsg.Length = 0;
            if ("json".Equals(wt))
            {
                ResponseMsg.Append("{");
                ResponseMsg.AppendFormat("\"errcode\":\"{0}\",", "1000");
                ResponseMsg.AppendFormat("\"errmsg\":\"{0}\"", ErrMsg);
                ResponseMsg.Append("}");
            }
            else
            {
                ResponseMsg.Append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
                ResponseMsg.Append("<PayPlatRequestParameter>");
                ResponseMsg.Append("<PARAMETERS>");
                ResponseMsg.AppendFormat("<ErrCode>{0}</ErrCode>", "1000");
                ResponseMsg.AppendFormat("<ErrMsg>{0}</ErrMsg>", ErrMsg);
                ResponseMsg.Append("</PARAMETERS>");
                ResponseMsg.Append("</PayPlatRequestParameter>");
            }
            return ResponseMsg.ToString();

        }
        else
        {
            String t_custid = PhoneBO.IsAuthenPhone(Phone, SPID, out ErrMsg);
            // t_custid 可以为空,但不能是别人的custid,可以为空是说明此客户无认证电话
            if (!String.IsNullOrEmpty(t_custid))
            {
                if (CustID != t_custid)
                {
                    //是别人的手机号,不能用来开户  return
                    ResponseMsg.Length = 0;
                    if ("json".Equals(wt))
                    {
                        ResponseMsg.Append("{");
                        ResponseMsg.AppendFormat("\"errcode\":\"{0}\",", "1000");
                        ResponseMsg.AppendFormat("\"errmsg\":\"{0}\"", Phone + "(" + CustID + ")是别人的手机号(" + t_custid + "),不能用来开户!");
                        ResponseMsg.Append("}");
                    }
                    else
                    {
                        ResponseMsg.Append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
                        ResponseMsg.Append("<PayPlatRequestParameter>");
                        ResponseMsg.Append("<PARAMETERS>");
                        ResponseMsg.AppendFormat("<ErrCode>{0}</ErrCode>", "1000");
                        ResponseMsg.AppendFormat("<ErrMsg>{0}</ErrMsg>", "是别人的手机号,不能用来开户!");
                        ResponseMsg.Append("</PARAMETERS>");
                        ResponseMsg.Append("</PayPlatRequestParameter>");
                    }
                    return ResponseMsg.ToString();
                }
            }

            if (!CommonUtility.CheckIDCard(IDCard))
            {
                //身份证不合法! return
                ResponseMsg.Length = 0;
                if ("json".Equals(wt))
                {
                    ResponseMsg.Append("{");
                    ResponseMsg.AppendFormat("\"errcode\":\"{0}\",", "1001");
                    ResponseMsg.AppendFormat("\"errmsg\":\"{0}\"", "身份证不合法!");
                    ResponseMsg.Append("}");
                }
                else
                {
                    ResponseMsg.Append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
                    ResponseMsg.Append("<PayPlatRequestParameter>");
                    ResponseMsg.Append("<PARAMETERS>");
                    ResponseMsg.AppendFormat("<ErrCode>{0}</ErrCode>", "1001");
                    ResponseMsg.AppendFormat("<ErrMsg>{0}</ErrMsg>", "身份证不合法!");
                    ResponseMsg.Append("</PARAMETERS>");
                    ResponseMsg.Append("</PayPlatRequestParameter>");
                }
                return ResponseMsg.ToString();

            }

            try
            {
                String TransactionID = CreateTransactionID();
                BesttoneAccountDAO _besttoneAccount_dao = new BesttoneAccountDAO();
                //strLog.AppendFormat("select * from besttoneaccount where custid={0}\r\n", CustID);
                BesttoneAccount besttoneAccountEntity = _besttoneAccount_dao.QueryByCustID(CustID);

                AccountItem ai = new AccountItem();
                String QueryBAResponseCode = "";

                if (besttoneAccountEntity == null)   // 未绑定
                {
                    //去翼支付查
                    int QueryBesttoneAccountResult = QueryBesttoneAccount(Phone, out ai, out QueryBAResponseCode, out ErrMsg);

                    //if (QueryBesttoneAccountResult == 0)
                    //{
                        if ("200010".Equals(QueryBAResponseCode))   // 未开户
                        {
                            UserRegistry.BeforeCreateBesttoneAccount(SPID, TransactionID, CustID, Phone, out  ErrMsg);  //日志
                            RegisterBesttoneAccount(Phone, RealName, ContactTel, Email, Sex, "1", IDCard, TransactionID, out ErrMsg);
                            UserRegistry.CreateBesttoneAccount(SPID, CustID, Phone, out ErrMsg);   //建立绑定关系
                            UserRegistry.AfterCreateBesttoneAccount(SPID, TransactionID, CustID, Phone, out  ErrMsg); //日志
                            UserRegistry.WriteBackBestToneAccountToCustInfo(SPID, CustID, RealName, IDCard, out ErrMsg);
                            ResponseMsg.Length = 0;
                            if ("json".Equals(wt))
                            {
                                ResponseMsg.Append("{");
                                ResponseMsg.AppendFormat("\"errcode\":\"{0}\",", "0");
                                ResponseMsg.AppendFormat("\"errmsg\":\"{0}\"", "开户成功,绑定成功!");
                                ResponseMsg.Append("}");
                            }
                            else
                            {
                                ResponseMsg.Append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
                                ResponseMsg.Append("<PayPlatRequestParameter>");
                                ResponseMsg.Append("<PARAMETERS>");
                                ResponseMsg.AppendFormat("<ErrCode>{0}</ErrCode>", "0");
                                ResponseMsg.AppendFormat("<ErrMsg>{0}</ErrMsg>", "开户成功,绑定成功!");
                                ResponseMsg.Append("</PARAMETERS>");
                                ResponseMsg.Append("</PayPlatRequestParameter>");
                            }
                            return ResponseMsg.ToString();
                        }
                        else
                        {   //可能在开过户
                            if ("000000".Equals(QueryBAResponseCode))
                            {
                                //绑定操作
                                UserRegistry.CreateBesttoneAccount(SPID, CustID, Phone, out ErrMsg);
                                UserRegistry.OnlyBindingBesttoneAccount(SPID, TransactionID, CustID, Phone, out  ErrMsg);

                                ResponseMsg.Length = 0;
                                if ("json".Equals(wt))
                                {
                                    ResponseMsg.Append("{");
                                    ResponseMsg.AppendFormat("\"errcode\":\"{0}\",", "0");
                                    ResponseMsg.AppendFormat("\"errmsg\":\"{0}\"", "仅仅绑定成功!");
                                    ResponseMsg.Append("}");
                                }
                                else
                                {
                                    ResponseMsg.Append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
                                    ResponseMsg.Append("<PayPlatRequestParameter>");
                                    ResponseMsg.Append("<PARAMETERS>");
                                    ResponseMsg.AppendFormat("<ErrCode>{0}</ErrCode>", "0");
                                    ResponseMsg.AppendFormat("<ErrMsg>{0}</ErrMsg>", "仅仅绑定成功!");
                                    ResponseMsg.Append("</PARAMETERS>");
                                    ResponseMsg.Append("</PayPlatRequestParameter>");
                                }
                                return ResponseMsg.ToString();
                            }
                            else
                            {
                                //账户状态可能存在异常  return

                                ResponseMsg.Length = 0;
                                if ("json".Equals(wt))
                                {
                                    ResponseMsg.Append("{");
                                    ResponseMsg.AppendFormat("\"errcode\":\"{0}\",", "1002");
                                    ResponseMsg.AppendFormat("\"errmsg\":\"{0}\"", "账户状态可能存在异常!");
                                    ResponseMsg.Append("}");
                                }
                                else
                                {
                                    ResponseMsg.Append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
                                    ResponseMsg.Append("<PayPlatRequestParameter>");
                                    ResponseMsg.Append("<PARAMETERS>");
                                    ResponseMsg.AppendFormat("<ErrCode>{0}</ErrCode>", "1002");
                                    ResponseMsg.AppendFormat("<ErrMsg>{0}</ErrMsg>", "账户状态可能存在异常!");
                                    ResponseMsg.Append("</PARAMETERS>");
                                    ResponseMsg.Append("</PayPlatRequestParameter>");
                                }
                                return ResponseMsg.ToString();
                            }
                        }
                    //}
                    //else
                    //{
                        ////账户查询过程中发生异常  return
                        //ResponseMsg.Length = 0;
                        //if ("json".Equals(wt))
                        //{
                        //    ResponseMsg.Append("{");
                        //    ResponseMsg.AppendFormat("\"errcode\":\"{0}\",", "1003");
                        //    ResponseMsg.AppendFormat("\"errmsg\":\"{0}\"", "账户查询过程中发生异常!");
                        //    ResponseMsg.Append("}");
                        //}
                        //else
                        //{
                        //    ResponseMsg.Append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
                        //    ResponseMsg.Append("<PayPlatRequestParameter>");
                        //    ResponseMsg.Append("<PARAMETERS>");
                        //    ResponseMsg.AppendFormat("<ErrCode>{0}</ErrCode>", "1003");
                        //    ResponseMsg.AppendFormat("<ErrMsg>{0}</ErrMsg>", "账户查询过程中发生异常!");
                        //    ResponseMsg.Append("</PARAMETERS>");
                        //    ResponseMsg.Append("</PayPlatRequestParameter>");
                        //}
                        //return ResponseMsg.ToString();
                    //}

                }
                else
                {
                    //该手机号码已经开过户,账户所绑定的custid不管是不是自己的,都不允许再开户
                    ResponseMsg.Length = 0;
                    if ("json".Equals(wt))
                    {
                        ResponseMsg.Append("{");
                        ResponseMsg.AppendFormat("\"errcode\":\"{0}\",", "1004");
                        ResponseMsg.AppendFormat("\"errmsg\":\"{0}\"", "该手机号码已经开过户!");
                        ResponseMsg.Append("}");
                    }
                    else
                    {
                        ResponseMsg.Append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
                        ResponseMsg.Append("<PayPlatRequestParameter>");
                        ResponseMsg.Append("<PARAMETERS>");
                        ResponseMsg.AppendFormat("<ErrCode>{0}</ErrCode>", "1004");
                        ResponseMsg.AppendFormat("<ErrMsg>{0}</ErrMsg>", "该手机号码已经开过户!");
                        ResponseMsg.Append("</PARAMETERS>");
                        ResponseMsg.Append("</PayPlatRequestParameter>");
                    }
                    return ResponseMsg.ToString();
                }

            }
            catch (Exception ecp)
            {
                ResponseMsg.Length = 0;
                if ("json".Equals(wt))
                {
                    ResponseMsg.Append("{");
                    ResponseMsg.AppendFormat("\"errcode\":\"{0}\",", "1005");
                    ResponseMsg.AppendFormat("\"errmsg\":\"{0}\"", ecp.ToString());
                    ResponseMsg.Append("}");
                }
                else
                {
                    ResponseMsg.Append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
                    ResponseMsg.Append("<PayPlatRequestParameter>");
                    ResponseMsg.Append("<PARAMETERS>");
                    ResponseMsg.AppendFormat("<ErrCode>{0}</ErrCode>", "1005");
                    ResponseMsg.AppendFormat("<ErrMsg>{0}</ErrMsg>", ecp.ToString());
                    ResponseMsg.Append("</PARAMETERS>");
                    ResponseMsg.Append("</PayPlatRequestParameter>");
                }
                return ResponseMsg.ToString();
            }

        }

        // 开户的前置条件
        //1.必须先登录(说明是合法号百客户,有CUSTID)
        //2.手机验证码校验  (如果是接口,仅校验手机验证码,如果是页面,则需校验页面验证码?)
        //3.检查手机号码是否是别人的登录账号 (登录后获得的custid和custphone 的custid比对)
        //4.验证身份证号是否合法
        //5.检查手机号码是否是别人的支付账户 (是否已经存在绑定关系,如果是,是否是绑定在自己的custid下)
        //6.去翼支付检查该手机号码是否开过户(直接调翼支付账户查询)

        //开户

        //IF 校验码未通过
        //    重定向到错误页面(如果是接口,则返回错误提示)
        //ELSE
        //      IF 根据PHONE 获得的CUSTID不是 登录CUSTID
        //           非法开户,重定向到错误页面 (如果是接口,则返回错误提示)  --
        //      ELSE
        //            IF PHONE 存在于账户绑定关系
        //    IF 账户对应的CUSTID 与登录后获得的CUSTID 不匹配   -- 说明该手机号码已经被别的客户开成账户了
        //           该手机号码已经被别的客户开成账户了,重定向到错误页面,如果是接口,则返回错误提示信息
        //                ELSE
        //                      该手机已经开过户,不需要再开户
        //    END
        //           ELSE
        //                     IF 翼支付没能能查到该手机的账户信息 --说明的确未开户
        //                              验证身份证号是否合法
        //                               开户 (调用翼支付开户接口)
        //                                插入绑定关系表
        //                     END
        //           END
        //       END
        //END
        return ResponseMsg.ToString();
    }
示例#6
0
    public GetAccountInfoResult GetAccountInfo(String Request)
    {
        GetAccountInfoResult getAccountInfoResult = new GetAccountInfoResult();
        String ReturnCode = "";
        String Descriptioin = "";
        StringBuilder Response = new StringBuilder();
        Response.AppendFormat("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
        #region
        XmlDocument xmlDoc = new XmlDocument();
        xmlDoc.LoadXml(Request);
        XmlNode versionNode = xmlDoc.SelectNodes("/root/callinfo/version")[0];
        String version = versionNode.Attributes["value"].Value;

        XmlNode SPIDNode = xmlDoc.SelectNodes("/root/callinfo/SPID")[0];
        String SPID = SPIDNode.Attributes["value"].Value;

        XmlNode CustIDNode = xmlDoc.SelectNodes("/root/srchcond/conds/CUSTID")[0];
        String CustID = CustIDNode.Attributes["value"].Value;

        XmlNode BesttoneAccountNode = xmlDoc.SelectNodes("/root/srchcond/conds/BesttoneAccount")[0];
        String BA = BesttoneAccountNode.Attributes["value"].Value;
        #endregion

        int Result = 0;
        String ErrMsg = "";

        StringBuilder strLog = new StringBuilder();
        try
        {
            #region 条件校验
            if (CommonUtility.IsEmpty(SPID))
            {
                ReturnCode = Convert.ToString(ErrorDefinition.CIP_IError_Result_SPIDInValid_Code);
                Descriptioin = ErrorDefinition.CIP_IError_Result_SPIDInValid_Msg;
                Response.AppendFormat("<result returnCode = {0} msg = {1} />", ReturnCode, Descriptioin);
                //return Response.ToString();
                getAccountInfoResult.ReturnCode = Convert.ToString(ErrorDefinition.CIP_IError_Result_SPIDInValid_Code);
                getAccountInfoResult.Msg = ErrorDefinition.CIP_IError_Result_SPIDInValid_Msg;
                return getAccountInfoResult;
            }

            //IP是否允许访问
            Result = CommonBizRules.CheckIPLimit(SPID, HttpContext.Current.Request.UserHostAddress, this.Context, out ErrMsg);
            strLog.AppendFormat("请求方ip:{0}\r\n", HttpContext.Current.Request.UserHostAddress);
            strLog.AppendFormat("CheckIPLimit Result:{0},ErrMsg:{1}\r\n", Result, ErrMsg);
            if (Result != 0)
            {
                ReturnCode = Convert.ToString(ErrorDefinition.BT_IError_Result_BizIPLimit_Code);
                Descriptioin = ErrorDefinition.BT_IError_Result_BizIPLimit_Msg;
                //Response.AppendFormat("<result returnCode = {0} msg = {1} />", ReturnCode, Descriptioin);
                //return Response.ToString();
                getAccountInfoResult.ReturnCode = Convert.ToString(ErrorDefinition.BT_IError_Result_BizIPLimit_Code);
                getAccountInfoResult.Msg = ErrorDefinition.BT_IError_Result_BizIPLimit_Msg;
                return getAccountInfoResult;
            }

            //接口访问权限判断
            Result = CommonBizRules.CheckInterfaceLimit(SPID, "GetAccountInfo", this.Context, out ErrMsg);
            strLog.AppendFormat("CheckInterfaceLimit Result:{0},ErrMsg:{1}\r\n", Result, ErrMsg);
            if (Result != 0)
            {
                //return Result;
                ReturnCode = Convert.ToString(ErrorDefinition.BT_IError_Result_BizInterfaceLimit_Code);
                Descriptioin = ErrorDefinition.BT_IError_Result_BizInterfaceLimit_Msg;
                Response.AppendFormat("<result returnCode = {0} msg = {1} />", ReturnCode, Descriptioin);
                //return Response.ToString();
                getAccountInfoResult.ReturnCode = ReturnCode;
                getAccountInfoResult.Msg = Descriptioin;
                return getAccountInfoResult;
            }

            if (CommonUtility.IsEmpty(CustID) && CommonUtility.IsEmpty(BA))
            {
                ReturnCode = Convert.ToString(ErrorDefinition.BT_IError_Result_BizInterfaceLimit_Code);
                Descriptioin = "CustID和BesttoneAccount不能同时为空!";
                Response.AppendFormat("<result returnCode = {0} msg = {1} />", ReturnCode, Descriptioin);
                //return Response.ToString();
                getAccountInfoResult.ReturnCode = ReturnCode;
                getAccountInfoResult.Msg = Descriptioin;
                return getAccountInfoResult;
            }
            BesttoneAccount account = null;
            BesttoneAccountDAO dao = new BesttoneAccountDAO();

            if (!CommonUtility.IsEmpty(CustID))
            {
                account = dao.QueryByCustID(CustID);
            }

            if (!CommonUtility.IsEmpty(BA))
            {
                account = dao.QueryByBestAccount(BA);
            }

            if (account == null)
            {
                ReturnCode = Convert.ToString(ErrorDefinition.BT_IError_Result_BizInterfaceLimit_Code);
                Descriptioin = "账户不存在!";
                Response.AppendFormat("<result returnCode = {0} msg = {1} />", ReturnCode, Descriptioin);
                //return Response.ToString();
                getAccountInfoResult.ReturnCode = ReturnCode;
                getAccountInfoResult.Msg = Descriptioin;
                return getAccountInfoResult;
            }

            //查询账户余额
            AccountItem item;
            Result = BesttoneAccountHelper.QueryBesttoneAccount(account.BestPayAccount, out item, out ErrMsg);
            if (Result == 0)
            {
                AccountInfoData data = new AccountInfoData();
                getAccountInfoResult.ReturnCode = "0";
                getAccountInfoResult.Msg = "成.功";
                data.Id = "";
                data.CustID = account.CustID;
                data.BesttoneAccount = account.BestPayAccount;
                data.AccountType = item.AccountType;
                data.AccountStatus = item.AccountStatus;
                data.AccountBalance = item.AccountBalance;
                data.PredayBalance = item.PredayBalance;
                data.PremonthBalance = item.PreMonthBalance;
                data.AvailableBalance = item.AvailableBalance;
                data.UnavailableBalance = item.UnAvailableBalance;
                data.AvailableCash = item.AvailableLecash;
                data.CardNum = item.CardNum;
                data.CardType = item.CardType;
                getAccountInfoResult.data = data;
                //Response.AppendFormat("<Result returnCode = \"0\" msg = \"成功\">");
                //Response.AppendFormat("<Data ID = \"\">");
                //Response.AppendFormat("<CUSTID>{0}</CUSTID>", account.CustID);
                //Response.AppendFormat("<BESTTONEACCOUNT>{0}</BESTTONEACCOUNT>", account.BestPayAccount);
                //Response.AppendFormat("<ACCOUNTTYPE>{0}</ACCOUNTTYPE>", item.AccountType);

                //Response.AppendFormat("<ACCOUNTSTATUS>{0}</ACCOUNTSTATUS>", item.AccountStatus);
                //Response.AppendFormat("<ACCOUNTBALANCE>{0}</ACCOUNTBALANCE>", item.AvailableBalance);
                //Response.AppendFormat("<PREDAYBALANCE>{0}</PREDAYBALANCE>", item.PredayBalance);
                //Response.AppendFormat("<PREMONTHBALANCE>{0}</PREMONTHBALANCE>", item.PreMonthBalance);
                //Response.AppendFormat("<AVAILABLEBALANCE>{0}</AVAILABLEBALANCE>", item.AvailableBalance);
                //Response.AppendFormat("<UNAVAILABLEBALANCE>{0}</UNAVAILABLEBALANCE>", item.UnAvailableBalance);
                //Response.AppendFormat("<AVAILABLECASH>{0}</AVAILABLECASH>", item.AvailableLecash);
                //Response.AppendFormat("<CARDNUM>{0}</CARDNUM>", item.CardNum);
                //Response.AppendFormat("<CARDTYPE>{0}</CARDTYPE>", item.CardType);
                //Response.AppendFormat("</Data>");
                //Response.AppendFormat("</Result>");

            }
            else {
                ReturnCode = Convert.ToString(ErrorDefinition.BT_IError_Result_BizInterfaceLimit_Code);
                Descriptioin = "账户查询失败!";
                //Response.AppendFormat("<result returnCode = {0} msg = {1} />", ReturnCode, Descriptioin);
                getAccountInfoResult.ReturnCode = ReturnCode;
                getAccountInfoResult.Msg = Descriptioin;
            }
            #endregion
        }
        catch (Exception e)
        {
            getAccountInfoResult.ReturnCode = "-9001";
            getAccountInfoResult.Msg = e.ToString();
        }
        //return Response.ToString();
        return getAccountInfoResult;
    }
示例#7
0
    public GetAccountBalanceResult GetAccountBalanceV2(String Request)
    {
        GetAccountBalanceResult getAccountBalanceResult = new GetAccountBalanceResult();
        String ReturnCode = "0";
        String Descriptioin = "成功";
        StringBuilder Response = new StringBuilder();
        Response.AppendFormat("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
        #region
        XmlDocument xmlDoc = new XmlDocument();
        xmlDoc.LoadXml(Request);
        XmlNode versionNode = xmlDoc.SelectNodes("/root/callinfo/version")[0];
        String version = versionNode.Attributes["value"].Value;

        XmlNode SPIDNode = xmlDoc.SelectNodes("/root/callinfo/SPID")[0];
        String SPID = SPIDNode.Attributes["value"].Value;

        XmlNode CustIDNode = xmlDoc.SelectNodes("/root/srchcond/conds/CUSTID")[0];
        String CustID = CustIDNode.Attributes["value"].Value;

        XmlNode BesttoneAccountNode = xmlDoc.SelectNodes("/root/srchcond/conds/BesttoneAccount")[0];
        String BA = BesttoneAccountNode.Attributes["value"].Value;
        #endregion

        int Result = 0;
        String ErrMsg = "";

        StringBuilder strLog = new StringBuilder();
        strLog.AppendFormat("请求参数xml:{0}\r\n",Request);
        try
        {
            #region 条件校验
            if (CommonUtility.IsEmpty(SPID))
            {
                ReturnCode = Convert.ToString(ErrorDefinition.CIP_IError_Result_SPIDInValid_Code);
                Descriptioin = ErrorDefinition.CIP_IError_Result_SPIDInValid_Msg;
                getAccountBalanceResult.returnCode = ReturnCode;
                getAccountBalanceResult.msg = Descriptioin;
                return getAccountBalanceResult;
                //Response.AppendFormat("<result returnCode = {0} msg = {1} />", ReturnCode, Descriptioin);
                //return Response.ToString();
            }

            //IP是否允许访问
            Result = CommonBizRules.CheckIPLimit(SPID, HttpContext.Current.Request.UserHostAddress, this.Context, out ErrMsg);
            strLog.AppendFormat("请求方ip:{0}\r\n", HttpContext.Current.Request.UserHostAddress);
            strLog.AppendFormat("CheckIPLimit Result:{0},ErrMsg:{1}\r\n", Result, ErrMsg);
            if (Result != 0)
            {
                //return Result;
                ReturnCode = Convert.ToString(ErrorDefinition.BT_IError_Result_BizIPLimit_Code);
                Descriptioin = ErrorDefinition.BT_IError_Result_BizIPLimit_Msg;
                getAccountBalanceResult.returnCode = ReturnCode;
                getAccountBalanceResult.msg = Descriptioin;
                return getAccountBalanceResult;
                //Response.AppendFormat("<result returnCode = {0} msg = {1} />", ReturnCode, Descriptioin);
                //return Response.ToString();

            }

            //接口访问权限判断
            Result = CommonBizRules.CheckInterfaceLimit(SPID, "GetAccountBalance", this.Context, out ErrMsg);
            strLog.AppendFormat("CheckInterfaceLimit Result:{0},ErrMsg:{1}\r\n", Result, ErrMsg);
            if (Result != 0)
            {
                //return Result;
                ReturnCode = Convert.ToString(ErrorDefinition.BT_IError_Result_BizInterfaceLimit_Code);
                Descriptioin = ErrorDefinition.BT_IError_Result_BizInterfaceLimit_Msg;
                getAccountBalanceResult.returnCode = ReturnCode;
                getAccountBalanceResult.msg = Descriptioin;
                return getAccountBalanceResult;
                //Response.AppendFormat("<result returnCode = {0} msg = {1} />", ReturnCode, Descriptioin);
                //return Response.ToString();
            }

            if (CommonUtility.IsEmpty(CustID) && CommonUtility.IsEmpty(BA))
            {
                ReturnCode = Convert.ToString(ErrorDefinition.BT_IError_Result_BizInterfaceLimit_Code);
                Descriptioin = "CustID和BesttoneAccount不能同时为空!";
                getAccountBalanceResult.returnCode = ReturnCode;
                getAccountBalanceResult.msg = Descriptioin;
                return getAccountBalanceResult;
                //Response.AppendFormat("<result returnCode = {0} msg = {1} />", ReturnCode, Descriptioin);
                //return Response.ToString();
            }
            BesttoneAccount account = null;
            BesttoneAccountDAO dao = new BesttoneAccountDAO();

            if (!CommonUtility.IsEmpty(CustID))
            {
                account = dao.QueryByCustID(CustID);
            }

            if (!CommonUtility.IsEmpty(BA))
            {
                account = dao.QueryByBestAccount(BA);
            }

            if (account == null)
            {
                ReturnCode = Convert.ToString(ErrorDefinition.BT_IError_Result_BizInterfaceLimit_Code);
                Descriptioin = "账户不存在!";
                getAccountBalanceResult.returnCode = ReturnCode;
                getAccountBalanceResult.msg = Descriptioin;
                return getAccountBalanceResult;
                //Response.AppendFormat("<result returnCode = {0} msg = {1} />", ReturnCode, Descriptioin);
                //return Response.ToString();
            }

            //查询账户余额
            long balance = 0;
            Int32 QueryAccountBalanceResult = BesttoneAccountHelper.QueryAccountBalance(account.BestPayAccount, out balance, out ErrMsg);

            if (QueryAccountBalanceResult == 0)
            {
                GetAccountBalanceData data = new GetAccountBalanceData();
                //Response.AppendFormat("<Result returnCode = \"0\" msg = \"成功\">");
                //Response.AppendFormat("<Data ID = \"\">");
                getAccountBalanceResult.returnCode = "0";
                getAccountBalanceResult.msg = "成功";
                data.Id = "";
                data.CustID = account.CustID;
                data.CustID = account.BestPayAccount;
                data.Balance = balance;
                getAccountBalanceResult.data = data;
                //Response.AppendFormat("<CUSTID>{0}</CUSTID>", account.CustID);
                //Response.AppendFormat("<BESTTONEACCOUNT>{0}</BESTTONEACCOUNT>", account.BestPayAccount);
                //Response.AppendFormat("<BALANCE>{0}</BALANCE>", balance);
                //Response.AppendFormat("</Data>");
                //Response.AppendFormat("</Result>");

            }
            else
            {
                ReturnCode = Convert.ToString(ErrorDefinition.BT_IError_Result_BizInterfaceLimit_Code);
                Descriptioin = "账户查询失败!";
                //Response.AppendFormat("<result returnCode = {0} msg = {1} />", ReturnCode, Descriptioin);
                getAccountBalanceResult.returnCode = ReturnCode;
                getAccountBalanceResult.msg = Descriptioin;
            }
            #endregion
        }
        catch (Exception e)
        {
            getAccountBalanceResult.returnCode = "-9002";
            getAccountBalanceResult.msg = e.ToString() ;
        }
        //return Response.ToString();
        return getAccountBalanceResult;
    }
示例#8
0
    public AccountBalanceQueryResult AccountBalanceQuery(String SPID, String CustID)
    {
        AccountBalanceQueryResult Result = new AccountBalanceQueryResult();
        Result.Result = ErrorDefinition.CIP_IError_Result_UnknowError_Code;
        Result.ErrMsg = ErrorDefinition.CIP_IError_Result_UnknowError_Msg;
        try
        {
            #region 数据合法性判断
            if (CommonUtility.IsEmpty(SPID))
            {
                Result.Result = ErrorDefinition.CIP_IError_Result_SPIDInValid_Code;
                Result.ErrMsg = ErrorDefinition.CIP_IError_Result_SPIDInValid_Msg;
                return Result;
            }

            //IP是否允许访问
            Result.Result = CommonBizRules.CheckIPLimit(SPID, HttpContext.Current.Request.UserHostAddress, this.Context, out Result.ErrMsg);
            if (Result.Result != 0)
            {
                return Result;
            }

            //接口访问权限判断
            Result.Result = CommonBizRules.CheckInterfaceLimit(SPID, "AccountInfoQuery", this.Context, out Result.ErrMsg);
            if (Result.Result != 0)
            {
                return Result;
            }

            if (CommonUtility.IsEmpty(CustID))
            {
                Result.Result = ErrorDefinition.CIP_IError_Result_User_UserIDInValid_Code;
                Result.ErrMsg = ErrorDefinition.CIP_IError_Result_User_UserIDInValid_Msg;
                return Result;
            }

            #endregion

            BesttoneAccountDAO _besttoneAccount_dao = new BesttoneAccountDAO();
            BesttoneAccount entity = _besttoneAccount_dao.QueryByCustID(CustID);
            if (entity == null)
            {
                Result.Result = ErrorDefinition.CIP_IError_Result_BesttoneAccount_UnRegister_Code;
                Result.ErrMsg = ErrorDefinition.CIP_IError_Result_BesttoneAccount_UnRegister_Msg;
            }
            else
            {
                long balance = 0;
                //查询账户余额
                Result.Result = BesttoneAccountHelper.QueryAccountBalance(entity.BestPayAccount, out balance, out Result.ErrMsg);
                Result.Balance = balance.ToString();
            }
        }
        catch (Exception ex)
        {
            Result.Result = ErrorDefinition.CIP_IError_Result_BesttoneAcountException_Code;
            Result.ErrMsg = ErrorDefinition.CIP_IError_Result_BesttoneAcountException_Msg + "," + ex.Message;
        }
        finally
        {
            //记录日志
        }
        return Result;
    }
示例#9
0
    public RechargeResult Recharge(String Request)
    {
        RechargeResult rechargeResult = new RechargeResult();

        int Result = 0;
        String ErrMsg = "";

        StringBuilder strLog = new StringBuilder();

        StringBuilder Response = new StringBuilder();
        Response.AppendFormat("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");

        #region 解析xml
        XmlDocument xmlDoc = new XmlDocument();
        xmlDoc.LoadXml(Request);
        XmlNode versionNode = xmlDoc.SelectNodes("/root/callinfo/version")[0];
        String version = versionNode.Attributes["value"].Value;

        XmlNode SPIDNode = xmlDoc.SelectNodes("/root/callinfo/SPID")[0];
        String SPID = SPIDNode.Attributes["value"].Value;

        XmlNode CardTypeNode = xmlDoc.SelectNodes("/root/srchcond/conds/CardType")[0];
        String CardType = CardTypeNode.Attributes["value"].Value;

        XmlNode CustIDNode = xmlDoc.SelectNodes("/root/srchcond/conds/CustID")[0];
        String CustID = CustIDNode.Attributes["value"].Value;

        XmlNode BesttoneAccountNode = xmlDoc.SelectNodes("/root/srchcond/conds/BesttoneAccount")[0];
        String BesttoneAccount = CustIDNode.Attributes["value"].Value;

        XmlNode CardNoNode = xmlDoc.SelectNodes("/root/srchcond/conds/CardNo")[0];
        String CardNo = CardNoNode.Attributes["value"].Value;

        XmlNode CardPasswordNode = xmlDoc.SelectNodes("/root/srchcond/conds/CardPassword")[0];
        String CardPassword = CardPasswordNode.Attributes["value"].Value;

        #endregion

        #region 请求数据校验

        if (String.IsNullOrEmpty(CustID) && String.IsNullOrEmpty(BesttoneAccount))
        {
            //返回错误
            rechargeResult.ReturnCode = "-10";
            rechargeResult.Msg = "CUSTID 和BesttoneAccount 不能同时为空! ";
            return rechargeResult;
        }

        #endregion

        #region 权限校验
        #endregion

        long accountBalance = 0;        //账户余额
        long cardBalance = 0;           //卡余额
        //String accountType = BesttoneAccountHelper.ConvertAccountType(cardType);            //转换卡类型
        /*********************************************查询账户信息*****************************************************/
        BesttoneAccountDAO _besttoneAccount_dao = new BesttoneAccountDAO();
        BesttoneAccount account_entity = null;
        //订单充值操作类
        RechargeOrderDAO _rechargeOrder_dao = new RechargeOrderDAO();
        //卡扣款记录操作类
        CardRechargeRecordDAO _cardRechargeRecord_dao = new CardRechargeRecordDAO();
        //充值操作类
        AccountRechargeRecordDAO _accountRechargeRecord_dao = new AccountRechargeRecordDAO();

        if (!String.IsNullOrEmpty(CustID))
        {
            account_entity = _besttoneAccount_dao.QueryByCustID(CustID);
        }

        if (!String.IsNullOrEmpty(BesttoneAccount))
        {
            account_entity = _besttoneAccount_dao.QueryByBestAccount(BesttoneAccount);
           }

        #region 卡余额查询

        //查询卡余额
        Result = BesttoneAccountHelper.QueryCardBalance(CardNo, CardType, out cardBalance, out ErrMsg);
        strLog.AppendFormat("[查询卡余额]:Result:{0},Balance:{1}\r\n", Result, cardBalance);

        //查询失败
        //if (Result != 0)
        //    return "[{\"result\":\"false\",\"step\":\"query\",\"errorcode\":\"" + Result + "\",\"info\":\"查询余额失败\"}]";
        //if (Result != 0)
        //    return "<?xml version=\"1.0\" encoding=\"UTF-8\"><Result ReturnCode='" + Result + "' Msg='" + 查询余额失败 + "'  />";

        if (Result != 0)
        {
            rechargeResult.ReturnCode = "-11";
            rechargeResult.Msg = "查询余额失败";
            return rechargeResult;
        }

        //卡余额为0
        //if (cardBalance == 0)
        //    return "[{\"result\":\"false\",\"step\":\"query\",\"errorcode\":\"200020\",\"info\":\"卡内余额为0\"}]";

        if (cardBalance == 0)
        {
            rechargeResult.ReturnCode = "200020";
            rechargeResult.Msg = "卡内余额为0";
            return rechargeResult;
        }

        //if (Result != 0)
        //    return "<?xml version=\"1.0\" encoding=\"UTF-8\"><Result ReturnCode='200020' Msg='" + 卡内余额为0 + "'  />";

        #endregion

        #region 账户充值金额上限校验

        long OnceRechargeLimit = BesttoneAccountConstDefinition.DefaultInstance.AccountRechargeLimitedOne;              //单笔充值金额上限
        long RechargeAmountLimit = BesttoneAccountConstDefinition.DefaultInstance.AccountRechargeLimitedDay;            //账户单日充值额度上限
        long CurrentAmountLimit = BesttoneAccountConstDefinition.DefaultInstance.AccountBalanceLimited;                 //账户余额上限
        if (OnceRechargeLimit > 0)
        {
            //检测用户单笔充值金额是否超限(10000元)
            //if (cardBalance > OnceRechargeLimit)
            //    return "[{\"result\":\"false\",\"step\":\"query\",\"errorcode\":\"100003\",\"rechargeamount\":\"" + BesttoneAccountHelper.ConvertAmountToYuan(cardBalance) + "\",\"rechargeamountlimit\":\"" + BesttoneAccountHelper.ConvertAmountToYuan(OnceRechargeLimit) + "\",\"info\":\"卡内余额为0\"}]";
            //if (Result != 0)
            //    return "<?xml version=\"1.0\" encoding=\"UTF-8\"><Result ReturnCode='100003' Rechargeamount='" + BesttoneAccountHelper.ConvertAmountToYuan(cardBalance) + "' Rechargeamountlimit='" + BesttoneAccountHelper.ConvertAmountToYuan(OnceRechargeLimit) + "' />";

            if (Result != 0)
            {
                rechargeResult.ReturnCode = "100003";
                rechargeResult.Msg = "单笔充值金额是否超限(10000元)";
                rechargeResult.Rechargeamount = BesttoneAccountHelper.ConvertAmountToYuan(cardBalance);
                rechargeResult.Rechargeamountlimit = BesttoneAccountHelper.ConvertAmountToYuan(OnceRechargeLimit);
                return rechargeResult;
            }

        }
        if (RechargeAmountLimit > 0)
        {
            //检测用户当日充值是否超限(当日充值金额不能超过50000元)
            long hadRechargeAmount = _rechargeOrder_dao.QueryCurrentRechargeAmount(account_entity.BestPayAccount);
            //if ((hadRechargeAmount + cardBalance) > RechargeAmountLimit)
            //    return "[{\"result\":\"false\",\"step\":\"query\",\"errorcode\":\"100001\",\"rechargeamount\":\"" + BesttoneAccountHelper.ConvertAmountToYuan(hadRechargeAmount) + "\",\"rechargeamountlimit\":\"" + BesttoneAccountHelper.ConvertAmountToYuan(RechargeAmountLimit) + "\",\"info\":\"卡内余额为0\"}]";
            //if (Result != 0)
            //    return "<?xml version=\"1.0\" encoding=\"UTF-8\"><Result ReturnCode='100001' Rechargeamount='" + BesttoneAccountHelper.ConvertAmountToYuan(hadRechargeAmount) + "' Rechargeamountlimit='" + BesttoneAccountHelper.ConvertAmountToYuan(OnceRechargeLimit) + "' />";
            rechargeResult.ReturnCode = "100001";
            rechargeResult.Msg = "当日充值金额不能超过50000元";
            rechargeResult.Rechargeamount = BesttoneAccountHelper.ConvertAmountToYuan(cardBalance);
            rechargeResult.Rechargeamountlimit = BesttoneAccountHelper.ConvertAmountToYuan(OnceRechargeLimit);
            return rechargeResult;

        }

        if (CurrentAmountLimit > 0)
        {
            //检测用户帐户余额(个人账户余额不能超过100000元)
            Result = BesttoneAccountHelper.QueryAccountBalance(account_entity.BestPayAccount, out accountBalance, out ErrMsg);
            //if (Result != 0)
            //    return "[{\"result\":\"false\",\"step\":\"query\",\"errorcode\":\"" + Result + "\",\"info\":\"账户信息查询失败\"}]";

            //if (Result != 0)
            //    return "<?xml version=\"1.0\" encoding=\"UTF-8\"><Result ReturnCode='" + Result + "' Msg='账户信息查询失败'  />";

            //if ((accountBalance + cardBalance) > CurrentAmountLimit)
            //    return "[{\"result\":\"false\",\"step\":\"query\",\"errorcode\":\"100002\",\"accountbalance\":\"" + BesttoneAccountHelper.ConvertAmountToYuan(accountBalance) + "\",\"CurrentAmountLimit\":\"" + BesttoneAccountHelper.ConvertAmountToYuan(CurrentAmountLimit) + "\",\"info\":\"卡内余额为0\"}]";
            //accountBalance = 0;

            //if ((accountBalance + cardBalance) > CurrentAmountLimit)
            //    return "<?xml version=\"1.0\" encoding=\"UTF-8\"><Result ReturnCode='100002' Accountbalance='" + BesttoneAccountHelper.ConvertAmountToYuan(accountBalance) + "' CurrentAmountLimit='" + BesttoneAccountHelper.ConvertAmountToYuan(CurrentAmountLimit) + "'  />";

            if ((accountBalance + cardBalance) > CurrentAmountLimit)
            {
                rechargeResult.ReturnCode = "100001";
                rechargeResult.Msg = "当日充值金额不能超过50000元";
                rechargeResult.Rechargeamount = BesttoneAccountHelper.ConvertAmountToYuan(cardBalance);
                rechargeResult.Rechargeamountlimit = BesttoneAccountHelper.ConvertAmountToYuan(OnceRechargeLimit);
                return rechargeResult;
            }

        }

        #endregion

        #region 卡扣款

        String transactionID = BesttoneAccountHelper.CreateTransactionID();
        String orderSeq = BesttoneAccountHelper.CreateOrderSeq();
        DateTime reqTime = DateTime.Now;

        RechargeOrder _recharge_order;              //充值订单
        CardRechargeRecord cardrecharge_entity;     //卡扣款流水记录

        //初始化充值订单
        _recharge_order = new RechargeOrder(orderSeq, transactionID, reqTime.ToString("yyyyMMdd"), "RMB", cardBalance, cardBalance, 0, "消费卡向账户充值扣款",
            account_entity.CustID, account_entity.BestPayAccount, CardType, SPID, reqTime, new DateTime(1900, 1, 1), new DateTime(1900, 1, 1), 1, 0, "", "", "", "0");  //2013-04-13 add 最后一个字段 0 代表是否需要开票

        //初始化卡扣款流水
        cardrecharge_entity = new CardRechargeRecord(transactionID, orderSeq, reqTime.ToString("yyyyMMdd"), "RMB", cardBalance, "消费卡向账户充值扣款", CardNo, CardPassword, CardType,
            account_entity.BestPayAccount, 0, reqTime, new DateTime(1900, 1, 1), "", "", "", "", "");

        /***********************************************************开始扣款*******************************************************/
        String uptranSeq = String.Empty;                        //交易流水号,支付平台返回的,后期对账用
        Result = BesttoneAccountHelper.CardDeductionBalance(transactionID, orderSeq, CardNo, CardPassword, CardType, cardBalance, reqTime, "", out uptranSeq, out ErrMsg);
        strLog.AppendFormat("[卡扣款]:Result:{0},ErrMsg:{1}\r\n", Result, ErrMsg);
        _recharge_order.UptranSeq = uptranSeq;
        cardrecharge_entity.UptranSeq = uptranSeq;
        if (Result != 0)
        {
            //修改订单信息
            _recharge_order.Status = 4;
            _recharge_order.PayTime = DateTime.Now;
            _recharge_order.ReturnCode = Result.ToString();
            _recharge_order.ReturnDesc = ErrMsg;
            _rechargeOrder_dao.Insert(_recharge_order);

            //修改卡扣款记录信息
            cardrecharge_entity.Status = 2;
            cardrecharge_entity.PayTime = DateTime.Now;
            cardrecharge_entity.ReturnCode = Result.ToString();
            cardrecharge_entity.ReturnDesc = ErrMsg;
            _cardRechargeRecord_dao.Insert(cardrecharge_entity);
            //return "<?xml version=\"1.0\" encoding=\"UTF-8\"><Result ReturnCode='" + Result + "' Msg='卡扣款失败'   />";

            //return "[{\"result\":\"false\",\"step\":\"deduction\",\"errorcode\":\"" + Result + "\",\"info\":\"卡扣款失败\"}]";
            rechargeResult.ReturnCode = Convert.ToString(Result);
            rechargeResult.Msg = "卡扣款失败!";

            return rechargeResult;
        }
        else
        {
            //修改订单信息
            _recharge_order.Status = 2;
            _recharge_order.PayTime = DateTime.Now;
            _recharge_order.ReturnCode = "0000";
            _recharge_order.ReturnDesc = "扣款成功";
            _rechargeOrder_dao.Insert(_recharge_order);

            //修改卡充值记录信息
            cardrecharge_entity.Status = 1;
            cardrecharge_entity.PayTime = DateTime.Now;
            cardrecharge_entity.ReturnCode = "0000";
            cardrecharge_entity.ReturnDesc = "扣款成功";
            _cardRechargeRecord_dao.Insert(cardrecharge_entity);
        }

        #endregion

        #region 充值

        transactionID = BesttoneAccountHelper.CreateTransactionID();        //充值流水记录
        DateTime rechargeTime = DateTime.Now;                               //充值请求时间
        String returnMsg = String.Empty;
        bool resultBoolean = false;

        //初始化充值流水类
        AccountRechargeRecord rechargeRecord_entity = new AccountRechargeRecord(transactionID, rechargeTime.ToString("yyyyMMdd"), orderSeq,
            cardBalance, CardType, "消费卡充值", rechargeTime, new DateTime(1900, 1, 1), 0, "", "");

        try
        {
            #region 开始充值

            //调用接口给账户充值
            Result = BesttoneAccountHelper.AccountRecharge(transactionID, account_entity.BestPayAccount, cardBalance, rechargeTime, out accountBalance, out ErrMsg);
            //调用接口给账户充值—测试
            //Result = BesttoneAccountHelper.AccountRecharge(transactionID, account_entity.BestPayAccount, 1, rechargeTime, out accountBalance, out ErrMsg);
            strLog.AppendFormat("[账户充值]:TransactionID:{0},Result:{1},ErrMsg:{2}\r\n", transactionID, Result, ErrMsg);
            if (Result == 0)
            {
                //修改订单信息
                _recharge_order = _rechargeOrder_dao.QueryByOrderSeq(orderSeq);
                _recharge_order.Status = 3;
                _recharge_order.RechargeCount = 1;
                _recharge_order.CompleteTime = DateTime.Now;
                _recharge_order.ReturnCode = "0000";
                _recharge_order.ReturnDesc = "充值成功";
                resultBoolean = _rechargeOrder_dao.Update(_recharge_order);

                //修改充值流水记录信息
                rechargeRecord_entity.Status = 1;
                rechargeRecord_entity.CompleteTime = DateTime.Now;
                rechargeRecord_entity.ReturnCode = "0000";
                rechargeRecord_entity.ReturnDesc = "充值成功";

                strLog.AppendFormat("[更新订单状态]ResultBoolean:{0}\r\n", resultBoolean);
                returnMsg = "[{\"result\":\"true\",\"info\":\"账户充值成功\",\"deductionBalance\":\"" + BesttoneAccountHelper.ConvertAmountToYuan(cardBalance) + "\",\"accountBalance\":\"" + BesttoneAccountHelper.ConvertAmountToYuan(accountBalance) + "\"}]";
                //return "<?xml version=\"1.0\" encoding=\"UTF-8\"><Result ReturnCode='" + Result + "' Msg='卡扣款失败'   />";
                //returnMsg = "<?xml version=\"1.0\" encoding=\"UTF-8\"><Result ReturnCode='" + 0 + "' Msg='账户充值成功'  deductionBalance='" + BesttoneAccountHelper.ConvertAmountToYuan(cardBalance) + "' accountBalance='" + BesttoneAccountHelper.ConvertAmountToYuan(accountBalance) + "' />";
                rechargeResult.Msg = "账户充值成功";
                rechargeResult.ReturnCode = "0";
                rechargeResult.Rechargeamount = BesttoneAccountHelper.ConvertAmountToYuan(accountBalance);
                return rechargeResult;
            }
            else
            {
                //修改订单信息
                _recharge_order = _rechargeOrder_dao.QueryByOrderSeq(orderSeq);
                _recharge_order.RechargeCount = 1;
                _recharge_order.ReturnCode = Result.ToString();
                _recharge_order.ReturnDesc = ErrMsg;
                resultBoolean = _rechargeOrder_dao.Update(_recharge_order);

                //修改充值流水记录信息
                rechargeRecord_entity.Status = 2;
                rechargeRecord_entity.CompleteTime = DateTime.Now;
                rechargeRecord_entity.ReturnCode = Result.ToString();
                rechargeRecord_entity.ReturnDesc = ErrMsg;

                returnMsg = "[{\"result\":\"false\",\"step\":\"recharge\",\"errorcode\":\"" + Result + "\",\"info\":\"账户充值失败\"}]";
                //returnMsg = "<?xml version=\"1.0\" encoding=\"UTF-8\"><Result ReturnCode='" + Result + "' Msg='账户充值失败'   />";
                rechargeResult.ReturnCode = "" + Result+"";
                rechargeResult.Msg = "账户充值失败";
                return rechargeResult;
            }

            #endregion
        }
        catch (Exception ex)
        {
            rechargeRecord_entity.ReturnDesc += ex.Message;
            throw ex;
        }
        finally
        {
            _accountRechargeRecord_dao.Insert(rechargeRecord_entity);
        }

        #endregion
        return rechargeResult;
    }
示例#10
0
    public AccountInfoQueryResult AccountInfoQuery(String SPID, String CustID)
    {
        AccountInfoQueryResult Result = new AccountInfoQueryResult();
        Result.Result = ErrorDefinition.CIP_IError_Result_UnknowError_Code;
        Result.ErrMsg = ErrorDefinition.CIP_IError_Result_UnknowError_Msg;
        Result.CustID = CustID;
        try
        {
            #region 数据合法性判断
            if (CommonUtility.IsEmpty(SPID))
            {
                Result.Result = ErrorDefinition.CIP_IError_Result_SPIDInValid_Code;
                Result.ErrMsg = ErrorDefinition.CIP_IError_Result_SPIDInValid_Msg;
                return Result;
            }

            //IP是否允许访问
            Result.Result = CommonBizRules.CheckIPLimit(SPID, HttpContext.Current.Request.UserHostAddress, this.Context, out Result.ErrMsg);
            if (Result.Result != 0)
            {
                return Result;
            }

            //接口访问权限判断
            Result.Result = CommonBizRules.CheckInterfaceLimit(SPID, "AccountInfoQuery", this.Context, out Result.ErrMsg);
            if (Result.Result != 0)
            {
                return Result;
            }

            if (CommonUtility.IsEmpty(CustID))
            {
                Result.Result = ErrorDefinition.CIP_IError_Result_User_UserIDInValid_Code;
                Result.ErrMsg = ErrorDefinition.CIP_IError_Result_User_UserIDInValid_Msg;
                return Result;
            }

            #endregion

            BesttoneAccountDAO _besttoneAccount_dao = new BesttoneAccountDAO();
            BesttoneAccount entity = _besttoneAccount_dao.QueryByCustID(CustID);
            if (entity == null)
            {
                Result.Result = ErrorDefinition.CIP_IError_Result_BesttoneAccount_UnRegister_Code;
                Result.ErrMsg = ErrorDefinition.CIP_IError_Result_BesttoneAccount_UnRegister_Msg;
            }
            else
            {
                Result.Account = entity.BestPayAccount;
                //查询账户余额
                AccountItem item;
                Result.Result = BesttoneAccountHelper.QueryBesttoneAccount(entity.BestPayAccount, out item, out Result.ErrMsg);
                if (Result.Result == 0)
                {
                    Result.AccountNo = item.AccountNo;
                    Result.AccountName = item.AccountName;
                    Result.AccountType = item.AccountType;
                    Result.AccountStatus = item.AccountStatus;
                    Result.AccountBalance = item.AccountBalance.ToString();
                    Result.PredayBalance = item.PredayBalance.ToString();
                    Result.PreMonthBalance = item.PreMonthBalance.ToString();
                    Result.AvailableBalance = item.AvailableBalance.ToString();
                    Result.UnAvailableBalance = item.UnAvailableBalance.ToString();
                    Result.AvailableLecash = item.AvailableLecash.ToString();
                    Result.CardNum = item.CardNum;
                    Result.CardType = item.CardType;
                }
            }

        }
        catch (Exception ex)
        {
            Result.Result = ErrorDefinition.CIP_IError_Result_BesttoneAcountException_Code;
            Result.ErrMsg = ErrorDefinition.CIP_IError_Result_BesttoneAcountException_Msg + "," + ex.Message;
        }
        finally
        {

        }
        return Result;
    }
示例#11
0
    public OpenBesttoneAccountV2Result OpenBesttoneAccountV2(String Request)
    {
        OpenBesttoneAccountV2Result openBesttoneAccountV2Result = new OpenBesttoneAccountV2Result();
        String ReturnCode = "";
        String Descriptioin = "";
        int Result = 0;
        String ErrMsg = "";

        #region
        XmlDocument xmlDoc = new XmlDocument();
        String version = "";
        String SPID = "";
        String CustID = "";
        String EC = "";
        String HC = "";
        try
        {
            xmlDoc.LoadXml(Request);
            XmlNode versionNode = xmlDoc.SelectNodes("/root/callinfo/version")[0];
            version = versionNode.Attributes["value"].Value;

            XmlNode SPIDNode = xmlDoc.SelectNodes("/root/callinfo/SPID")[0];
            SPID = SPIDNode.Attributes["value"].Value;

            XmlNode CustIDNode = xmlDoc.SelectNodes("/root/param/CUSTID")[0];
            CustID = CustIDNode.Attributes["value"].Value;

            EC = xmlDoc.SelectNodes("/root/param/EC")[0].InnerText;
            HC = xmlDoc.SelectNodes("/root/param/HC")[0].InnerText;
        }
        catch (Exception e)
        {
            ReturnCode = Convert.ToString(ErrorDefinition.CIP_IError_Result_BesttoneAcountException_Code);
            ErrMsg = ErrorDefinition.CIP_IError_Result_BesttoneAcountException_Msg + "," + e.Message;
            Descriptioin = ErrMsg+":xml格式错误";
            //Response.AppendFormat("<result returnCode = '{0}' msg = '{1}' />", ReturnCode, Descriptioin);
            //return Response.ToString();
            openBesttoneAccountV2Result.returnCode = ReturnCode;
            openBesttoneAccountV2Result.msg = Descriptioin;
            return openBesttoneAccountV2Result;
        }
        //String AuthenCode = xmlDoc.SelectNodes("/root/param/AuthenCode")[0].InnerText;
        #endregion

        StringBuilder strLog = new StringBuilder();
        try
        {

            SPInfoManager spInfo = new SPInfoManager();
            Object SPData = spInfo.GetSPData(this.Context, "SPData");
            string ScoreSystemSecret = spInfo.GetPropertyBySPID(SPID, "SecretKey", SPData);

            string newHC = CryptographyUtil.GenerateAuthenticator(SPID + "$" + CustID + "$" + EC, ScoreSystemSecret);

            strLog.AppendFormat("HC:{0};newHC:{1}\r\n" , HC, newHC);
            string realName = "";
            string mobile = "";
            string contactTel = "";
            string email = "";
            string sex = "";
            string cerType = "";
            string cerNum = "";

            if (newHC.Equals(HC))
            {
                try
                {
                    string PlanTextStr = CryptographyUtil.Decrypt(EC.ToString(), ScoreSystemSecret);
                    if (String.IsNullOrEmpty(PlanTextStr))
                    {
                        ReturnCode = "-7020";
                        Descriptioin = "解密失败!" ;
                        openBesttoneAccountV2Result.returnCode = ReturnCode;
                        openBesttoneAccountV2Result.msg = Descriptioin;
                        return openBesttoneAccountV2Result;

                    }
                    strLog.AppendFormat("planTextStr:{0}\r\n", PlanTextStr);
                    string[] alSourceStr = PlanTextStr.Split('$');
                    realName = alSourceStr[0];
                    strLog.AppendFormat("realName:{0}\r\n", realName);
                    mobile = alSourceStr[1];
                    strLog.AppendFormat("mobile:{0}\r\n", mobile);
                    contactTel = alSourceStr[2];
                    strLog.AppendFormat("contactTel:{0}\r\n", contactTel);
                    email = alSourceStr[3];
                    strLog.AppendFormat("email:{0}\r\n", email);
                    sex = alSourceStr[4];
                    strLog.AppendFormat("sex:{0}\r\n", sex);
                    cerType = alSourceStr[5];
                    strLog.AppendFormat("cerType:{0}\r\n", cerType);
                    cerNum = alSourceStr[6];
                    strLog.AppendFormat("cerNum:{0}\r\n", cerNum);
                }
                catch (System.Exception e)
                {
                    ReturnCode = "-7020";
                    Descriptioin = "解密错误"+e.ToString();
                    openBesttoneAccountV2Result.returnCode = ReturnCode;
                    openBesttoneAccountV2Result.msg = Descriptioin;
                    return openBesttoneAccountV2Result;
                }
            }
            else
            {
                ReturnCode = "-7021";
                Descriptioin = "hashcode校验不通过!";
                openBesttoneAccountV2Result.returnCode = ReturnCode;
                openBesttoneAccountV2Result.msg = Descriptioin;
                return openBesttoneAccountV2Result;
            }

            strLog.AppendFormat("Begin 开通号码百事通账户\r\n");
            strLog.AppendFormat("SPID:{0},CustID:{1},mobile:{2},realName:{3},contactTel:{4},email:{5},sex:{6},cerType:{7},cerNum:{8}\r\n", SPID, CustID, mobile, realName, contactTel, email, sex, cerType, cerNum);

            #region 数据合法性判断

            //if (CommonUtility.IsEmpty(AuthenCode))
            //{
            //    ReturnCode = "-7014";
            //    Descriptioin = "手机校验码不能为空!";
            //    Response.AppendFormat("<result returnCode = {0} msg = {1} />", ReturnCode, Descriptioin);
            //    return Response.ToString();
            //}

            //验证码校验
            //Result = PhoneBO.SelSendSMSMassage(CustID, mobile, AuthenCode, out ErrMsg);
            //if (Result != 0)
            //{
            //    ReturnCode = "-7014";
            //    Descriptioin = "验证码验证失败:" + ErrMsg;
            //    Response.AppendFormat("<result returnCode = {0} msg = {1} />", ReturnCode, Descriptioin);
            //    return Response.ToString();

            //}

            if (CommonUtility.IsEmpty(SPID))
            {
                ReturnCode = Convert.ToString(ErrorDefinition.CIP_IError_Result_SPIDInValid_Code);
                Descriptioin = ErrorDefinition.CIP_IError_Result_SPIDInValid_Msg;
                openBesttoneAccountV2Result.returnCode = ReturnCode;
                openBesttoneAccountV2Result.msg = Descriptioin;
                return openBesttoneAccountV2Result;
            }

            //IP是否允许访问
            Result = CommonBizRules.CheckIPLimit(SPID, HttpContext.Current.Request.UserHostAddress, this.Context, out ErrMsg);
            strLog.AppendFormat("请求方ip:{0}\r\n", HttpContext.Current.Request.UserHostAddress);
            strLog.AppendFormat("CheckIPLimit Result:'{0}',ErrMsg:'{1}'\r\n", Result, ErrMsg);
            if (Result != 0)
            {
                ReturnCode = Convert.ToString(ErrorDefinition.BT_IError_Result_BizIPLimit_Code);
                Descriptioin = ErrorDefinition.BT_IError_Result_BizIPLimit_Msg;
                openBesttoneAccountV2Result.returnCode = ReturnCode;
                openBesttoneAccountV2Result.msg = Descriptioin;
                return openBesttoneAccountV2Result;

            }

            //接口访问权限判断
            Result = CommonBizRules.CheckInterfaceLimit(SPID, "OpenBesttoneAccountV2", this.Context, out ErrMsg);
            strLog.AppendFormat("CheckInterfaceLimit Result:{0},ErrMsg:{1}\r\n", Result, ErrMsg);
            if (Result != 0)
            {
                ReturnCode = Convert.ToString(ErrorDefinition.BT_IError_Result_BizInterfaceLimit_Code);
                Descriptioin = ErrorDefinition.BT_IError_Result_BizInterfaceLimit_Msg;
                openBesttoneAccountV2Result.returnCode = ReturnCode;
                openBesttoneAccountV2Result.msg = Descriptioin;
                return openBesttoneAccountV2Result;
            }

            if (CommonUtility.IsEmpty(CustID))
            {
                ReturnCode = Convert.ToString(ErrorDefinition.BT_IError_Result_InValidCustID_Code);
                Descriptioin = "CustID不能为空:"+ErrorDefinition.BT_IError_Result_InValidCustID_Msg;
                //Response.AppendFormat("<result returnCode = '{0}' msg = '{1}' />", ReturnCode, Descriptioin);
                //return Response.ToString();
                openBesttoneAccountV2Result.returnCode = ReturnCode;
                openBesttoneAccountV2Result.msg = Descriptioin;
                return openBesttoneAccountV2Result;
            }

            if (CommonUtility.IsEmpty(mobile))
            {
                ReturnCode = "-7015";
                Descriptioin = "账户名不能为空!";
                openBesttoneAccountV2Result.returnCode = ReturnCode;
                openBesttoneAccountV2Result.msg = Descriptioin;
                return openBesttoneAccountV2Result;

            }

            if (!Utils.isMobilePhoneV2(mobile))
            {
                ReturnCode = "-7016";
                Descriptioin = "无效的手机号码!";
                openBesttoneAccountV2Result.returnCode = ReturnCode;
                openBesttoneAccountV2Result.msg = Descriptioin;
                return openBesttoneAccountV2Result;
            }

            if (CommonUtility.IsEmpty(realName))
            {
                ReturnCode = "-7017";
                Descriptioin = "用户名不能为空!";
                openBesttoneAccountV2Result.returnCode = ReturnCode;
                openBesttoneAccountV2Result.msg = Descriptioin;
                return openBesttoneAccountV2Result;

            }

            if (CommonUtility.IsEmpty(sex))
            {
                ReturnCode = "-7018";
                Descriptioin = "性别不能为空!";
                openBesttoneAccountV2Result.returnCode = ReturnCode;
                openBesttoneAccountV2Result.msg = Descriptioin;
                return openBesttoneAccountV2Result;

            }
            if (!Utils.IsNumeric(sex))
            {
                ReturnCode = "-7019";
                Descriptioin = "性别只能为数字!";
                openBesttoneAccountV2Result.returnCode = ReturnCode;
                openBesttoneAccountV2Result.msg = Descriptioin;
                return openBesttoneAccountV2Result;
            }

            if ("0".Equals(sex) || "1".Equals(sex) || "2".Equals(sex))
            {
            }
            else
            {
                ReturnCode = "-7020";
                Descriptioin = "性别只能为0和1,2!";
                openBesttoneAccountV2Result.returnCode = ReturnCode;
                openBesttoneAccountV2Result.msg = Descriptioin;
                return openBesttoneAccountV2Result;
            }

            if (CommonUtility.IsEmpty(cerType))
            {
                ReturnCode = "-7021";
                Descriptioin = "证件类型不能为空!";
                openBesttoneAccountV2Result.returnCode = ReturnCode;
                openBesttoneAccountV2Result.msg = Descriptioin;
                return openBesttoneAccountV2Result;
            }

            if (cerType.Equals("1") || cerType.Equals("2") || cerType.Equals("3") || cerType.Equals("4") || cerType.Equals("5") || cerType.Equals("6") || cerType.Equals("7") || cerType.Equals("8") || cerType.Equals("9") || cerType.Equals("10") || cerType.Equals("X"))
            { }
            else
            {
                ReturnCode = "-7022";
                Descriptioin = "非法证件类型!";
                openBesttoneAccountV2Result.returnCode = ReturnCode;
                openBesttoneAccountV2Result.msg = Descriptioin;
                return openBesttoneAccountV2Result;

            }

            if (CommonUtility.IsEmpty(cerNum))
            {
                ReturnCode = "-7023";
                Descriptioin = "证件号不能为空!";
                openBesttoneAccountV2Result.returnCode = ReturnCode;
                openBesttoneAccountV2Result.msg = Descriptioin;
                return openBesttoneAccountV2Result;
            }

            if ("X".Equals(cerType))
            {
                if ("99999".Equals(cerNum))
                {
                }
                else
                {
                    ReturnCode = "-7024";
                    Descriptioin = "证件类型为其他类型(X),则证件号必须是99999!";
                    openBesttoneAccountV2Result.returnCode = ReturnCode;
                    openBesttoneAccountV2Result.msg = Descriptioin;
                    return openBesttoneAccountV2Result;
                }
            }

            if ("1".Equals(cerType))
            {
                if (!CommonUtility.CheckIDCard(cerNum))
                {
                    ReturnCode = "-7025";
                    Descriptioin = "身份证不合法!";
                    openBesttoneAccountV2Result.returnCode = ReturnCode;
                    openBesttoneAccountV2Result.msg = Descriptioin;
                    return openBesttoneAccountV2Result;
                }
            }

            #endregion

            String TransactionID = BesttoneAccountHelper.CreateTransactionID();
            BesttoneAccountDAO _besttoneAccount_dao = new BesttoneAccountDAO();
            strLog.AppendFormat("select * from besttoneaccount where custid={0}\r\n", CustID);
            BesttoneAccount besttoneAccountEntity = _besttoneAccount_dao.QueryByCustID(CustID);
            String ResponseCode = "";
            AccountItem ai = new AccountItem();
            if (besttoneAccountEntity == null)    // 未绑定
            {
                strLog.AppendFormat("0 records return\r\n");
                strLog.AppendFormat("未绑定\r\n");
                int QueryBesttoneAccountResult = BesttoneAccountHelper.BesttoneAccountInfoQuery(mobile, out ai,  out ResponseCode, out ErrMsg);
                strLog.AppendFormat("BesttoneAccountHelper.BesttoneAccountInfoQuery QueryBesttoneAccountResult:{0},ErrMsg:{1}\r\n ", QueryBesttoneAccountResult, ErrMsg);
                if (QueryBesttoneAccountResult == 0)
                {
                    if ("200010".Equals(ResponseCode))   // 未开户
                    {
                        strLog.AppendFormat("未绑定且未开户\r\n");
                        strLog.AppendFormat("准备去开户了\r\n");
                        strLog.AppendFormat("开户前日志,参数 SPID:{0},TransactionID:{1},CustID:{2},mobile:{3}", SPID, TransactionID, CustID, mobile);
                        UserRegistry.BeforeCreateBesttoneAccount(SPID, TransactionID, CustID, mobile, out  ErrMsg);  //日志
                        strLog.AppendFormat("开户前日志完成\r\n");
                        strLog.AppendFormat("开户......\r\n");
                        strLog.AppendFormat("开户参数:mobile:{0},realName:{1},contactTel:{2},email:{3},sex:{4},cerType:{5},cerNum:{6},TransactionID:{7}", mobile, realName, contactTel, email, sex, cerType, cerNum, TransactionID);
                        Result = BesttoneAccountHelper.RegisterBesttoneAccount(mobile, realName, contactTel, email, sex, cerType, cerNum, TransactionID, out ErrMsg);
                        strLog.AppendFormat("开户后返回的状态 Result:{0},ErrMsg:{1}\r\n", Result, ErrMsg);
                        //绑定操作
                        strLog.AppendFormat("开完户准备进行绑定,将{0}绑定至{1}\r\n", mobile, CustID);
                        UserRegistry.CreateBesttoneAccount(SPID, CustID, mobile, out ErrMsg);
                        strLog.AppendFormat("绑定后结果ErrMsg:{0}\r\n", ErrMsg);
                        UserRegistry.AfterCreateBesttoneAccount(SPID, TransactionID, CustID, mobile, out  ErrMsg); //日志
                        strLog.AppendFormat("开户后日志\r\n");
                        UserRegistry.WriteBackBestToneAccountToCustInfo(SPID, CustID, realName, cerNum, out ErrMsg);
                        strLog.AppendFormat("开户完成\r\n");
                        ReturnCode = "0";
                        Descriptioin = "开户成功";
                        openBesttoneAccountV2Result.returnCode = ReturnCode;
                        openBesttoneAccountV2Result.msg = Descriptioin;
                        return openBesttoneAccountV2Result;
                    }
                    else
                    {  // 已开户
                        //绑定操作
                        if ("000000".Equals(ResponseCode))
                        {
                            strLog.AppendFormat("未绑定且 已开户\r\n");
                            strLog.AppendFormat("仅绑定.......\r\n");
                            UserRegistry.CreateBesttoneAccount(SPID, CustID, mobile, out ErrMsg);
                            strLog.AppendFormat("将{0}绑定到{1}\r\n", mobile, CustID);
                            UserRegistry.OnlyBindingBesttoneAccount(SPID, TransactionID, CustID, mobile, out  ErrMsg);
                            strLog.AppendFormat("记录绑定日志表,流水号:{0}", TransactionID);
                            strLog.AppendFormat("绑定后结果ErrMsg:{0}\r\n", ErrMsg);
                            ReturnCode = "1";
                            Descriptioin = "该用户已开过户,仅做绑定关系";
                            openBesttoneAccountV2Result.returnCode = ReturnCode;
                            openBesttoneAccountV2Result.msg = Descriptioin;
                            return openBesttoneAccountV2Result;
                        }
                        else
                        {
                            ReturnCode = "-7026";
                            Descriptioin = ResponseCode;
                            openBesttoneAccountV2Result.returnCode = ReturnCode;
                            openBesttoneAccountV2Result.msg = Descriptioin;
                            return openBesttoneAccountV2Result;
                        }
                    }
                }
                else
                {
                    ReturnCode = "-7027";
                    Descriptioin = "查询账户出错!";
                    openBesttoneAccountV2Result.returnCode = ReturnCode;
                    openBesttoneAccountV2Result.msg = Descriptioin;
                    return openBesttoneAccountV2Result;
                }
            }
            else
            {
                // 账户已经绑定到其他人身上
                strLog.AppendFormat("1 record return.\r\n");
                strLog.AppendFormat("该CustID:{0}上已经有绑定的账户号{1}\r\n", CustID, mobile);

                Result = -12300;
                ErrMsg = mobile + "手机号已为其他客户(" + CustID + ")开通了号码百事通账户,您可以登录系统,进入您的账户中心,用另一手机号码开通号码百事通账户,也可以咨询客服人员帮助排查问题。";
                openBesttoneAccountV2Result.returnCode = "-12300";
                openBesttoneAccountV2Result.msg = ErrMsg;
                return openBesttoneAccountV2Result;

            }
            strLog.AppendFormat("End 开通号码百事通账户 Result:{0},ErrMsg{1}\r\n", Result, ErrMsg);
            //-99999 失败 0 成功
        }
        catch (Exception e)
        {
            ReturnCode = Convert.ToString(ErrorDefinition.CIP_IError_Result_BesttoneAcountException_Code);
            ErrMsg = ErrorDefinition.CIP_IError_Result_BesttoneAcountException_Msg + "," + e.Message;
            openBesttoneAccountV2Result.returnCode = ReturnCode;
            openBesttoneAccountV2Result.msg = ErrMsg+e.ToString();
            return openBesttoneAccountV2Result;
        }
        finally
        {
            log(strLog.ToString(),"OpenBesttoneAccountV2");
        }
        openBesttoneAccountV2Result.returnCode = ReturnCode;
        openBesttoneAccountV2Result.msg = Descriptioin;
        return openBesttoneAccountV2Result;
    }
示例#12
0
    public OpenBesttoneAccountResult OpenBesttoneAccount(String SPID, String CustID, String EC,String HC)
    {
        OpenBesttoneAccountResult Result = new OpenBesttoneAccountResult();
        Result.Result = ErrorDefinition.CIP_IError_Result_UnknowError_Code;
        Result.ErrMsg = ErrorDefinition.CIP_IError_Result_UnknowError_Msg;
        StringBuilder strLog = new StringBuilder();
        try
        {

            SPInfoManager spInfo = new SPInfoManager();
            Object SPData = spInfo.GetSPData(this.Context, "SPData");
            string ScoreSystemSecret = spInfo.GetPropertyBySPID(SPID, "SecretKey", SPData);

            string newHC= CryptographyUtil.GenerateAuthenticator(SPID + "$" + CustID + "$" + EC, ScoreSystemSecret);

            strLog.AppendFormat("HC:{0};newHC:{1}\r\n"+HC,newHC);
            string realName = "";
            string mobile = "";
            string contactTel = "";
            string email = "";
            string sex = "";
            string cerType = "";
            string cerNum = "";

            if (newHC.Equals(HC))
            {
                try
                {
                    string PlanTextStr = CryptographyUtil.Decrypt(EC.ToString(), ScoreSystemSecret);
                    strLog.AppendFormat("planTextStr:{0}\r\n",PlanTextStr);
                    string[] alSourceStr = PlanTextStr.Split('$');
                    realName = alSourceStr[0];
                    strLog.AppendFormat("realName:{0}\r\n", realName);
                    mobile = alSourceStr[1];
                    strLog.AppendFormat("mobile:{0}\r\n",mobile);
                    contactTel = alSourceStr[2];
                    strLog.AppendFormat("contactTel:{0}\r\n",contactTel);
                    email = alSourceStr[3];
                    strLog.AppendFormat("email:{0}\r\n",email);
                    sex = alSourceStr[4];
                    strLog.AppendFormat("sex:{0}\r\n",sex);
                    cerType = alSourceStr[5];
                    strLog.AppendFormat("cerType:{0}\r\n",cerType);
                    cerNum = alSourceStr[6];
                    strLog.AppendFormat("cerNum:{0}\r\n",cerNum);
                }
                catch (System.Exception e)
                {
                    Result.Result = -7020;
                    Result.ErrMsg = "解密错误!"+e.ToString();
                    return Result;
                }

            }
            else {
                Result.Result = -7020;
                Result.ErrMsg = "hashcode校验不通过!";
                return Result;
            }

            strLog.AppendFormat("Begin 开通号码百事通账户\r\n");
            strLog.AppendFormat("SPID:{0},CustID:{1},mobile:{2},realName:{3},contactTel:{4},email:{5},sex:{6},cerType:{7},cerNum:{8}\r\n", SPID, CustID, mobile, realName, contactTel, email, sex, cerType, cerNum);

            #region 数据合法性判断
            if (CommonUtility.IsEmpty(SPID))
            {
                Result.Result = ErrorDefinition.CIP_IError_Result_SPIDInValid_Code;
                Result.ErrMsg = ErrorDefinition.CIP_IError_Result_SPIDInValid_Msg;
                return Result;
            }

            //IP是否允许访问
            Result.Result = CommonBizRules.CheckIPLimit(SPID, HttpContext.Current.Request.UserHostAddress, this.Context, out Result.ErrMsg);
            strLog.AppendFormat("请求方ip:{0}\r\n", HttpContext.Current.Request.UserHostAddress);
            strLog.AppendFormat("CheckIPLimit Result:{0},ErrMsg:{1}\r\n", Result.Result, Result.ErrMsg);
            if (Result.Result != 0)
            {
                return Result;
            }

            //接口访问权限判断
            Result.Result = CommonBizRules.CheckInterfaceLimit(SPID, "OpenBesttoneAccount", this.Context, out Result.ErrMsg);
            strLog.AppendFormat("CheckInterfaceLimit Result:{0},ErrMsg:{1}\r\n", Result.Result, Result.ErrMsg);
            if (Result.Result != 0)
            {
                return Result;
            }

            if (CommonUtility.IsEmpty(CustID))
            {
                Result.Result = ErrorDefinition.CIP_IError_Result_User_UserIDInValid_Code;
                Result.ErrMsg = ErrorDefinition.CIP_IError_Result_User_UserIDInValid_Msg;
                return Result;
            }
            if (CommonUtility.IsEmpty(mobile))
            {
                Result.Result = -7015;
                Result.ErrMsg = "账户名不能为空!";
                return Result;
            }
            if (!Utils.isMobilePhone(mobile))
            {
                Result.Result = -7015;
                Result.ErrMsg = "无效的手机号码!";
                return Result;
            }

            if (CommonUtility.IsEmpty(realName))
            {
                Result.Result = -7016;
                Result.ErrMsg = "用户名不能为空!";
                return Result;
            }
            if (CommonUtility.IsEmpty(sex))
            {
                Result.Result = -7017;
                Result.ErrMsg = "性别不能为空!";
                return Result;
            }
            if (!Utils.IsNumeric(sex))
            {
                Result.Result = -7017;
                Result.ErrMsg = "性别只能为数字!";
                return Result;
            }
            if ("0".Equals(sex) || "1".Equals(sex) || "2".Equals(sex))
            {
            }
            else
            {
                Result.Result = -7017;
                Result.ErrMsg = "性别只能为0和1,2!";
                return Result;
            }

            if (CommonUtility.IsEmpty(cerType))
            {
                Result.Result = -7018;
                Result.ErrMsg = "证件类型不能为空!";
                return Result;
            }

            if (cerType.Equals("1") || cerType.Equals("2") || cerType.Equals("3") || cerType.Equals("4") || cerType.Equals("5") || cerType.Equals("6") || cerType.Equals("7") || cerType.Equals("8") || cerType.Equals("9") || cerType.Equals("10") || cerType.Equals("X"))
            { }
            else
            {
                Result.Result = -7018;
                Result.ErrMsg = "非法证件类型!";
                return Result;
            }

            if (CommonUtility.IsEmpty(cerNum))
            {
                Result.Result = -7019;
                Result.ErrMsg = "证件号不能为空!";
                return Result;
            }

            if ("X".Equals(cerType))
            {
                if ("99999".Equals(cerNum))
                {
                }
                else
                {
                    Result.Result = -7019;
                    Result.ErrMsg = "证件类型为其他类型(X),则证件号必须是99999!";
                    return Result;
                }
            }

            if ("1".Equals(cerType))
            {
                if (!CommonUtility.CheckIDCard(cerNum))
                {
                    Result.Result = -7020;
                    Result.ErrMsg = "身份证不合法!";
                    return Result;
                }
            }

            #endregion

            String TransactionID = BesttoneAccountHelper.CreateTransactionID();
            BesttoneAccountDAO _besttoneAccount_dao = new BesttoneAccountDAO();
            strLog.AppendFormat("select * from besttoneaccount where custid={0}\r\n", CustID);
            BesttoneAccount besttoneAccountEntity = _besttoneAccount_dao.QueryByCustID(CustID);
            String ResponseCode = "";
            AccountItem ai = new AccountItem();
            if (besttoneAccountEntity == null)    // 未绑定
            {
                strLog.AppendFormat("0 records return\r\n");
                strLog.AppendFormat("未绑定\r\n");
                int QueryBesttoneAccountResult = BesttoneAccountHelper.BesttoneAccountInfoQuery(mobile, out ai, out ResponseCode, out Result.ErrMsg);
                strLog.AppendFormat("BesttoneAccountHelper.BesttoneAccountInfoQuery QueryBesttoneAccountResult:{0},ErrMsg:{1}\r\n ", QueryBesttoneAccountResult, Result.ErrMsg);
                if (QueryBesttoneAccountResult == 0)
                {
                    if ("200010".Equals(ResponseCode))   // 未开户
                    {
                        strLog.AppendFormat("未绑定且未开户\r\n");
                        strLog.AppendFormat("准备去开户了\r\n");
                        strLog.AppendFormat("开户前日志,参数 SPID:{0},TransactionID:{1},CustID:{2},mobile:{3}", SPID, TransactionID, CustID, mobile);
                        UserRegistry.BeforeCreateBesttoneAccount(SPID, TransactionID, CustID, mobile, out  Result.ErrMsg);  //日志
                        strLog.AppendFormat("开户前日志完成\r\n");
                        strLog.AppendFormat("开户......\r\n");
                        strLog.AppendFormat("开户参数:mobile:{0},realName:{1},contactTel:{2},email:{3},sex:{4},cerType:{5},cerNum:{6},TransactionID:{7}", mobile, realName, contactTel, email, sex, cerType, cerNum, TransactionID);
                        Result.Result = BesttoneAccountHelper.RegisterBesttoneAccount(mobile, realName, contactTel, email, sex, cerType, cerNum, TransactionID, out Result.ErrMsg);
                        strLog.AppendFormat("开户后返回的状态 Result:{0},ErrMsg:{1}\r\n", Result.Result, Result.ErrMsg);
                        //绑定操作
                        strLog.AppendFormat("开完户准备进行绑定,将{0}绑定至{1}\r\n", mobile, CustID);
                        UserRegistry.CreateBesttoneAccount(SPID, CustID, mobile, out Result.ErrMsg);
                        strLog.AppendFormat("绑定后结果ErrMsg:{0}\r\n", Result.ErrMsg);
                        UserRegistry.AfterCreateBesttoneAccount(SPID, TransactionID, CustID, mobile, out  Result.ErrMsg); //日志
                        strLog.AppendFormat("开户后日志\r\n");
                        UserRegistry.WriteBackBestToneAccountToCustInfo(SPID, CustID, realName, cerNum, out Result.ErrMsg);
                        strLog.AppendFormat("开户完成\r\n");
                    }
                    else
                    {  // 已开户
                        //绑定操作
                        if ("000000".Equals(ResponseCode))
                        {
                            strLog.AppendFormat("未绑定且 已开户\r\n");
                            strLog.AppendFormat("仅绑定.......\r\n");
                            UserRegistry.CreateBesttoneAccount(SPID, CustID, mobile, out Result.ErrMsg);
                            strLog.AppendFormat("将{0}绑定到{1}\r\n", mobile, CustID);
                            UserRegistry.OnlyBindingBesttoneAccount(SPID, TransactionID, CustID, mobile, out  Result.ErrMsg);
                            strLog.AppendFormat("记录绑定日志表,流水号:{0}", TransactionID);
                            strLog.AppendFormat("绑定后结果ErrMsg:{0}\r\n", Result.ErrMsg);
                        }
                        else
                        {
                            Result.Result = -25679;
                            Result.ErrMsg = ResponseCode;
                            return Result;
                        }
                    }
                }
                else
                {

                    Result.Result = QueryBesttoneAccountResult;
                    return Result;
                }
            }
            else
            {
                // 账户是否绑定到其他人身上
                strLog.AppendFormat("1 record return.\r\n");
                strLog.AppendFormat("该CustID:{1}上已经有绑定的账户号{1}\r\n", CustID, mobile);
                strLog.AppendFormat("检查改账户号{0}上是否绑定在别的CustID{1}上\r\n", mobile, CustID);
                BesttoneAccount besttoneCunsInfo = _besttoneAccount_dao.QueryByBestAccount(mobile);
                if (!besttoneCunsInfo.CustID.Equals(CustID))  // 绑定到了其他人身上
                {
                    strLog.AppendFormat("{0}绑定到了其他人身上,此人的CustID:{1}\r\n", mobile, CustID);
                    Result.Result = -12300;
                    Result.ErrMsg = mobile + "手机号已为其他客户(" + CustID + ")开通了号码百事通账户,您可以登录系统,进入您的账户中心,用另一手机号码开通号码百事通账户,也可以咨询客服人员帮助排查问题。";
                }
                strLog.AppendFormat("{0}没有绑定到其他人身上,此人的CustID:{1}\r\n", mobile, CustID);
                strLog.AppendFormat("去翼支付查询该账户号{0}是否存在\r\n", mobile);
                int QueryBesttoneAccountResult = BesttoneAccountHelper.BesttoneAccountInfoQuery(mobile, out ai, out ResponseCode, out Result.ErrMsg);
                if (QueryBesttoneAccountResult != 0)   // 未开户
                {
                    strLog.AppendFormat("翼支付查询返回说该账户号{0}不存在\r\n", mobile);
                    strLog.AppendFormat("准备去为{0}开户........\r\n", mobile);
                    strLog.AppendFormat("开户前日志,参数 SPID:{0},TransactionID:{1},CustID:{2},mobile:{3}", SPID, TransactionID, CustID, mobile);
                    UserRegistry.BeforeCreateBesttoneAccount(SPID, TransactionID, CustID, mobile, out  Result.ErrMsg);  //日志
                    strLog.AppendFormat("开户前日志完成\r\n");
                    strLog.AppendFormat("开户........\r\n");
                    strLog.AppendFormat("开户参数:mobile:{0},realName:{1},contactTel:{2},email:{3},sex:{4},cerType:{5},cerNum:{6},TransactionID:{7}\r\n", mobile, realName, contactTel, email, sex, cerType, cerNum, TransactionID);
                    Result.Result = BesttoneAccountHelper.RegisterBesttoneAccount(mobile, realName, contactTel, email, sex, cerType, cerNum, TransactionID, out Result.ErrMsg);
                    strLog.AppendFormat("开户完成,返回结果:Result:{0},ErrMsg:{1}\r\n", Result.Result, Result.ErrMsg);
                    //绑定操作
                    strLog.AppendFormat("绑定{0}到{1}\r\n", mobile, CustID);
                    UserRegistry.CreateBesttoneAccount(SPID, CustID, mobile, out Result.ErrMsg);
                    strLog.AppendFormat("绑定完成,返回结果 ErrMsg:{0}\r\n", Result.ErrMsg);
                    strLog.AppendFormat("开户后日志\r\n");
                    UserRegistry.AfterCreateBesttoneAccount(SPID, TransactionID, CustID, mobile, out  Result.ErrMsg); //日志
                    strLog.AppendFormat("开户后日志完成 ErrMsg:{0}\r\n", Result.ErrMsg);
                    UserRegistry.WriteBackBestToneAccountToCustInfo(SPID, CustID, realName, cerNum, out Result.ErrMsg);
                }
            }
            strLog.AppendFormat("End 开通号码百事通账户 Result:{0},ErrMsg{1}\r\n", Result.Result, Result.ErrMsg);
            //-99999 失败 0 成功

        }
        catch (Exception e)
        {
            Result.Result = ErrorDefinition.CIP_IError_Result_BesttoneAcountException_Code;
            Result.ErrMsg = ErrorDefinition.CIP_IError_Result_BesttoneAcountException_Msg + "," + e.Message;
        }
        finally
        {
            log(strLog.ToString());
        }
        return Result;
    }
示例#13
0
    public CustInfoQueryResult GetCustInfo(String Request)
    {
        CustInfoQueryResult custInfoQueryResult = new CustInfoQueryResult();
        String ReturnCode = "0";
        String Descriptioin = "成功";
        StringBuilder Response = new StringBuilder();
        Response.AppendFormat("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
        #region
        XmlDocument xmlDoc = new XmlDocument();
        String version = "";
        String SPID = "";
        String CustID = "";
        String BA = "";
        try
        {
            xmlDoc.LoadXml(Request);
            XmlNode versionNode = xmlDoc.SelectNodes("/root/callinfo/version")[0];
            version = versionNode.Attributes["value"].Value;

            XmlNode SPIDNode = xmlDoc.SelectNodes("/root/callinfo/SPID")[0];
            SPID = SPIDNode.Attributes["value"].Value;

            XmlNode CustIDNode = xmlDoc.SelectNodes("/root/srchcond/conds/CUSTID")[0];
            CustID = CustIDNode.Attributes["value"].Value;

            XmlNode BesttoneAccountNode = xmlDoc.SelectNodes("/root/srchcond/conds/BesttoneAccount")[0];
            BA = BesttoneAccountNode.Attributes["value"].Value;
        }
        catch (Exception e)
        {
            ReturnCode = Convert.ToString(ErrorDefinition.BT_IError_Result_BizInterfaceLimit_Code);
            Descriptioin = "客户信息询失败!-xml格式错误:"+e.ToString();
            //Response.AppendFormat("<result returnCode = {0} msg = {1} />", ReturnCode, Descriptioin);
            custInfoQueryResult.returnCode = ReturnCode;
            custInfoQueryResult.msg = Descriptioin;
            return custInfoQueryResult;
        }

        #endregion

        int Result = 0;
        String ErrMsg = "";

        StringBuilder strLog = new StringBuilder();
        try
        {
            #region 条件校验
            if (CommonUtility.IsEmpty(SPID))
            {
                ReturnCode = Convert.ToString(ErrorDefinition.CIP_IError_Result_SPIDInValid_Code);
                Descriptioin = ErrorDefinition.CIP_IError_Result_SPIDInValid_Msg;
                //Response.AppendFormat("<result returnCode = {0} msg = {1} />", ReturnCode, Descriptioin);
                //return Response.ToString();
                custInfoQueryResult.returnCode = ReturnCode;
                custInfoQueryResult.msg = Descriptioin;
                return custInfoQueryResult;
            }

            //IP是否允许访问
            Result = CommonBizRules.CheckIPLimit(SPID, HttpContext.Current.Request.UserHostAddress, this.Context, out ErrMsg);
            strLog.AppendFormat("请求方ip:{0}\r\n", HttpContext.Current.Request.UserHostAddress);
            strLog.AppendFormat("CheckIPLimit Result:{0},ErrMsg:{1}\r\n", Result, ErrMsg);
            if (Result != 0)
            {
                //return Result;
                ReturnCode = Convert.ToString(ErrorDefinition.BT_IError_Result_BizIPLimit_Code);
                Descriptioin = ErrorDefinition.BT_IError_Result_BizIPLimit_Msg;
                //Response.AppendFormat("<result returnCode = {0} msg = {1} />", ReturnCode, Descriptioin);
                //return Response.ToString();
                custInfoQueryResult.returnCode = ReturnCode;
                custInfoQueryResult.msg = Descriptioin;
                return custInfoQueryResult;

            }

            //接口访问权限判断
            Result = CommonBizRules.CheckInterfaceLimit(SPID, "GetCustInfo", this.Context, out ErrMsg);
            strLog.AppendFormat("CheckInterfaceLimit Result:{0},ErrMsg:{1}\r\n", Result, ErrMsg);
            if (Result != 0)
            {
                //return Result;
                ReturnCode = Convert.ToString(ErrorDefinition.BT_IError_Result_BizInterfaceLimit_Code);
                Descriptioin = ErrorDefinition.BT_IError_Result_BizInterfaceLimit_Msg;
                //Response.AppendFormat("<result returnCode = {0} msg = {1} />", ReturnCode, Descriptioin);
                //return Response.ToString();
                custInfoQueryResult.returnCode = ReturnCode;
                custInfoQueryResult.msg = Descriptioin;
                return custInfoQueryResult;
            }

            if (CommonUtility.IsEmpty(CustID) && CommonUtility.IsEmpty(BA))
            {
                ReturnCode = Convert.ToString(ErrorDefinition.BT_IError_Result_BizInterfaceLimit_Code);
                Descriptioin = "CustID和BesttoneAccount不能同时为空!";
                //Response.AppendFormat("<result returnCode = {0} msg = {1} />", ReturnCode, Descriptioin);
                //return Response.ToString();
                custInfoQueryResult.returnCode = ReturnCode;
                custInfoQueryResult.msg = Descriptioin;
                return custInfoQueryResult;
            }
            BesttoneAccount account = null;
            BesttoneAccountDAO dao = new BesttoneAccountDAO();

            if (!CommonUtility.IsEmpty(CustID))
            {
                account = dao.QueryByCustID(CustID);
            }

            if (!CommonUtility.IsEmpty(BA))
            {
                account = dao.QueryByBestAccount(BA);
            }

            if (account == null)
            {
                ReturnCode = Convert.ToString(ErrorDefinition.BT_IError_Result_BizInterfaceLimit_Code);
                Descriptioin = "账户不存在!";
                //Response.AppendFormat("<result returnCode = {0} msg = {1} />", ReturnCode, Descriptioin);
                //return Response.ToString();
                custInfoQueryResult.returnCode = ReturnCode;
                custInfoQueryResult.msg = Descriptioin;
                return custInfoQueryResult;
            }
            Linkage.BestTone.Interface.Rule.CustInfo custInfo = new Linkage.BestTone.Interface.Rule.CustInfo();
            int QueryCustInfoResult = BesttoneAccountHelper.QueryCustInfo(account.BestPayAccount, out custInfo, out ErrMsg);
            if (QueryCustInfoResult == 0)
            {
                custInfoQueryResult.returnCode = ReturnCode;
                custInfoQueryResult.msg = Descriptioin;
                CustInfoQueryData data = new CustInfoQueryData();

                //Response.AppendFormat("<Result returnCode = \"0\" msg = \"成功\">");
                //Response.AppendFormat("<Data ID = \"\">");
                //Response.AppendFormat("<CUSTID>{0}</CUSTID>", account.CustID);
                //Response.AppendFormat("<BESTTONEACCOUNT>{0}</BESTTONEACCOUNT>", custInfo.ProductNo);
                //Response.AppendFormat("<REALNAME>{0}</REALNAME>", custInfo.CustomerName);
                //Response.AppendFormat("<CERTIFICATETYPE>{0}</CERTIFICATETYPE>", custInfo.IdType);
                //Response.AppendFormat("<CERTIFICATECODE>{0}</CERTIFICATECODE>", custInfo.IdNo);
                //Response.AppendFormat("</Data>");
                //Response.AppendFormat("</Result>");
                data.Id = "";
                data.CustId = account.CustID;
                data.BesttoneAccount = custInfo.ProductNo;
                data.RealName = custInfo.CustomerName;
                data.CertificateType = custInfo.IdType;
                data.CertificateCode = custInfo.IdNo;
                custInfoQueryResult.data = data;
            }
            #endregion
        }
        catch (Exception e)
        {
            ReturnCode = Convert.ToString(ErrorDefinition.BT_IError_Result_BizInterfaceLimit_Code);
            Descriptioin = "客户信息询失败!";
            //Response.AppendFormat("<result returnCode = {0} msg = {1} />", ReturnCode, Descriptioin);
            custInfoQueryResult.returnCode = ReturnCode;
            custInfoQueryResult.msg = Descriptioin+e.ToString();
        }
        //return Response.ToString();
        return custInfoQueryResult;
    }
    public String GetAuthenCode(String SPID, String CustID,String wt)
    {
        StringBuilder ResponseMsg = new StringBuilder();

        #region
        if (CommonUtility.IsEmpty(SPID))
        {

            ResponseMsg.Length = 0;
            if ("json".Equals(wt))
            {
                ResponseMsg.Append("{");
                ResponseMsg.AppendFormat("\"errcode\":\"{0}\",", "995");
                ResponseMsg.AppendFormat("\"errmsg\":\"{0}\"", "SPID不能为空!");
                ResponseMsg.Append("}");
            }
            else
            {
                ResponseMsg.Append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
                ResponseMsg.Append("<PayPlatRequestParameter>");
                ResponseMsg.Append("<PARAMETERS>");
                ResponseMsg.AppendFormat("<ErrCode>{0}</ErrCode>", "995");
                ResponseMsg.AppendFormat("<ErrMsg>{0}</ErrMsg>", "SPID不能为空!");
                ResponseMsg.Append("</PARAMETERS>");
                ResponseMsg.Append("</PayPlatRequestParameter>");
            }
            return ResponseMsg.ToString();
        }

        if (CommonUtility.IsEmpty(CustID))
        {

            ResponseMsg.Length = 0;
            if ("json".Equals(wt))
            {
                ResponseMsg.Append("{");
                ResponseMsg.AppendFormat("\"errcode\":\"{0}\",", "995");
                ResponseMsg.AppendFormat("\"errmsg\":\"{0}\"", "CustID不能为空!");
                ResponseMsg.Append("}");
            }
            else
            {
                ResponseMsg.Append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
                ResponseMsg.Append("<PayPlatRequestParameter>");
                ResponseMsg.Append("<PARAMETERS>");
                ResponseMsg.AppendFormat("<ErrCode>{0}</ErrCode>", "995");
                ResponseMsg.AppendFormat("<ErrMsg>{0}</ErrMsg>", "CustID不能为空!");
                ResponseMsg.Append("</PARAMETERS>");
                ResponseMsg.Append("</PayPlatRequestParameter>");
            }
            return ResponseMsg.ToString();
        }

        String Phone = String.Empty;
        BesttoneAccount account = null;
        BesttoneAccountDAO dao = new BesttoneAccountDAO();
        account = dao.QueryByCustID(CustID);
        if (account != null)
        {
            Phone = account.BestPayAccount;
        }
        else
        {
            //未开户
            // 返回错误信息
            ResponseMsg.Length = 0;
            if ("json".Equals(wt))
            {
                ResponseMsg.Append("{");
                ResponseMsg.AppendFormat("\"errcode\":\"{0}\",", "997");
                ResponseMsg.AppendFormat("\"errmsg\":\"{0}\"", "该CustID尚未开户!");
                ResponseMsg.Append("}");
            }
            else
            {
                ResponseMsg.Append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
                ResponseMsg.Append("<PayPlatRequestParameter>");
                ResponseMsg.Append("<PARAMETERS>");
                ResponseMsg.AppendFormat("<ErrCode>{0}</ErrCode>", "997");
                ResponseMsg.AppendFormat("<ErrMsg>{0}</ErrMsg>", "该CustID尚未开户!");
                ResponseMsg.Append("</PARAMETERS>");
                ResponseMsg.Append("</PayPlatRequestParameter>");
            }
            return ResponseMsg.ToString();
        }

        #endregion

        try
        {
            //String CustID = PhoneBO.IsAuthenPhone(Phone, SPID, out ErrMsg);

            Result = CommonBizRules.SPInterfaceGrant(SPID, "GetAuthenCode", this.Context, out ErrMsg);
            if (Result != 0)
            {
                ResponseMsg.Length = 0;
                if ("json".Equals(wt))
                {
                    ResponseMsg.Append("{");
                    ResponseMsg.AppendFormat("\"errcode\":\"{0}\",", "991");
                    ResponseMsg.AppendFormat("\"errmsg\":\"{0}\"", "调用下行短信接口权限未开通!");
                    ResponseMsg.Append("}");
                }
                else
                {
                    ResponseMsg.Append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
                    ResponseMsg.Append("<PayPlatRequestParameter>");
                    ResponseMsg.Append("<PARAMETERS>");
                    ResponseMsg.AppendFormat("<ErrCode>{0}</ErrCode>", "991");
                    ResponseMsg.AppendFormat("<ErrMsg>{0}</ErrMsg>", "调用下行短信接口权限未开通!");
                    ResponseMsg.Append("</PARAMETERS>");
                    ResponseMsg.Append("</PayPlatRequestParameter>");
                }
                return ResponseMsg.ToString();

            }

            Random random = new Random();
            String AuthenCode = random.Next(111111, 999999).ToString();

            DateTime DealTime = DateTime.Now;
            int k = PhoneBO.PhoneSelV2("", Phone, out ErrMsg);    // 检查发送验证码次数
            if (k == 0)
            {
                CommonBizRules.SendMessageV3(Phone, "您正在通过翼购客户端找回支付密码,验证码为:" + AuthenCode + ",有效期2分钟。", SPID);
                Result = PhoneBO.InsertPhoneSendMassage(CustID, "您正在通过翼购客户端找回支付密码,验证码为:" + AuthenCode + ",有效期2分钟。", AuthenCode, Phone, DateTime.Now, "客户端找回支付密码", 1, 0, "1", out ErrMsg);

            }
            else
            {
                ResponseMsg.Length = 0;
                if ("json".Equals(wt))
                {
                    ResponseMsg.Append("{");
                    ResponseMsg.AppendFormat("\"errcode\":\"{0}\",", "992");
                    ResponseMsg.AppendFormat("\"errmsg\":\"{0}\"", "该手机号码已经被注册过了!");
                    ResponseMsg.Append("}");
                }
                else
                {
                    ResponseMsg.Append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
                    ResponseMsg.Append("<PayPlatRequestParameter>");
                    ResponseMsg.Append("<PARAMETERS>");
                    ResponseMsg.AppendFormat("<ErrCode>{0}</ErrCode>", "992");
                    ResponseMsg.AppendFormat("<ErrMsg>{0}</ErrMsg>", "该手机号码已经被注册过了!");
                    ResponseMsg.Append("</PARAMETERS>");
                    ResponseMsg.Append("</PayPlatRequestParameter>");
                }
                return ResponseMsg.ToString();
            }

            ResponseMsg.Length = 0;
            if ("json".Equals(wt))
            {
                ResponseMsg.Append("{");
                ResponseMsg.AppendFormat("\"errcode\":\"{0}\",", "0");
                ResponseMsg.AppendFormat("\"errmsg\":\"{0}\"", "您的验证码是:" + AuthenCode);
                ResponseMsg.Append("}");
            }
            else
            {
                ResponseMsg.Append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
                ResponseMsg.Append("<PayPlatRequestParameter>");
                ResponseMsg.Append("<PARAMETERS>");
                ResponseMsg.AppendFormat("<ErrCode>{0}</ErrCode>", "0");
                ResponseMsg.AppendFormat("<ErrMsg>{0}</ErrMsg>", "您的验证码是:" + AuthenCode);
                ResponseMsg.Append("</PARAMETERS>");
                ResponseMsg.Append("</PayPlatRequestParameter>");
            }
            return ResponseMsg.ToString();

        }
        catch (Exception exp)
        {
            if ("json".Equals(wt))
            {
                ResponseMsg.Append("{");
                ResponseMsg.AppendFormat("\"errcode\":\"{0}\",", "-25367");
                ResponseMsg.AppendFormat("\"errmsg\":\"{0}\"", "异常:" + exp.ToString());
                ResponseMsg.Append("}");
            }
            else
            {
                ResponseMsg.Append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
                ResponseMsg.Append("<PayPlatRequestParameter>");
                ResponseMsg.Append("<PARAMETERS>");
                ResponseMsg.AppendFormat("<ErrCode>{0}</ErrCode>", "-25367");
                ResponseMsg.AppendFormat("<ErrMsg>{0}</ErrMsg>", "异常:" + exp.ToString());
                ResponseMsg.Append("</PARAMETERS>");
                ResponseMsg.Append("</PayPlatRequestParameter>");
            }
            return ResponseMsg.ToString();
        }

        return ResponseMsg.ToString();
    }
示例#15
0
    protected String QueryAccountInfo()
    {
        //请求参数
        String CustID = Request["CustID"];
        String SPID = Request["SPID"];
        String wt = Request["wt"];   // json or xml

        logger.Info("AccountInfoQuery_log");
        logger.Info("CustID=" + CustID);
        logger.Info("SPID =" + SPID);
        logger.Info("writetype=" + wt);
        //返回参数
        String ErrMsg = String.Empty;
        Int32 Result = 0;
        Int32 ResultQueryCustInfo = 0;

        StringBuilder ResponseMsg = new StringBuilder();

        //账户信息字段
        String AccountNo = String.Empty;
        String AccountName = String.Empty;
        String AccountType = String.Empty;
        String AccountStatus = String.Empty;
        String AccountBalance = String.Empty;
        String PredayBalance = String.Empty;
        String PreMonthBalance = String.Empty;
        String AvailableBalance = String.Empty;
        String UnAvailableBalance = String.Empty;
        String AvailableLecash = String.Empty;
        String CardNum = String.Empty;
        String CardType = String.Empty;

        //客户信息字段
        String OuterID = String.Empty;
        String Status = String.Empty;
        String CustType = String.Empty;
        String CustLevel = String.Empty;
        String RealName = String.Empty;
        String UserName = String.Empty;
        String NickName = String.Empty;
        String CertificateCode = String.Empty;
        String CertificateType = String.Empty;
        String Sex = String.Empty;
        String Email = String.Empty;
        String EnterpriseID = String.Empty;
        String ProvinceID = String.Empty;
        String AreaID = String.Empty;
        String Registration = String.Empty;

        try
        {
            BesttoneAccountDAO _besttoneAccount_dao = new BesttoneAccountDAO();
            BesttoneAccount entity = _besttoneAccount_dao.QueryByCustID(CustID);
            if (entity == null)
            {
                // 返回错误信息
                ResponseMsg.Length = 0;
                if ("json".Equals(wt))
                {
                    ResponseMsg.Append("{");
                    ResponseMsg.AppendFormat("\"errcode\":\"{0}\",", "999");
                    ResponseMsg.AppendFormat("\"errmsg\":\"{0}\"", "无此用户");
                    ResponseMsg.Append("}");
                }
                else
                {
                    ResponseMsg.Append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
                    ResponseMsg.Append("<PayPlatRequestParameter>");
                    ResponseMsg.Append("<PARAMETERS>");
                    ResponseMsg.AppendFormat("<ErrCode>{0}</ErrCode>", "999");
                    ResponseMsg.AppendFormat("<ErrMsg>{0}</ErrMsg>", "无此账户");
                    ResponseMsg.Append("</PARAMETERS>");
                    ResponseMsg.Append("</PayPlatRequestParameter>");
                }
                logger.Info("根据custid查账号没查到!");
                return ResponseMsg.ToString();
            }
            else
            {
                //查询账户余额
                AccountItem item =null;
                ErrMsg = "";
                Result = QueryBesttoneAccount(entity.BestPayAccount, out item, out ErrMsg);
                if (Result == 0)
                {
                    logger.Info("AccountInfoQuery_log:账户查询成功");
                    if (item != null)
                    {
                        AccountNo = item.AccountNo;
                        AccountName = item.AccountName;    // 账户名称
                        AccountType = item.AccountType;        // 账户类型 (资金)
                        AccountStatus = item.AccountStatus;   //  账户状态
                        AccountBalance = item.AccountBalance.ToString();
                        PredayBalance = item.PredayBalance.ToString();
                        PreMonthBalance = item.PreMonthBalance.ToString();
                        AvailableBalance = item.AvailableBalance.ToString();
                        UnAvailableBalance = item.UnAvailableBalance.ToString();
                        AvailableLecash = item.AvailableLecash.ToString();
                        CardNum = item.CardNum;
                        CardType = item.CardType;

                        logger.Info("AccountNo=" + AccountNo);
                        logger.Info("AccountName=" + AccountName);
                        logger.Info("AccountType=" + AccountType);
                        logger.Info("AccountStatus=" + AccountStatus);
                        logger.Info("AccountBalance=" + AccountBalance);
                        logger.Info("PredayBalance=" + PredayBalance);
                        logger.Info("PreMonthBalance=" + PreMonthBalance);
                        logger.Info("AvailableBalance=" + AvailableBalance);
                        logger.Info("UnAvailableBalance=" + UnAvailableBalance);
                        logger.Info("CardNum=" + CardNum);
                        logger.Info("CardType=" + CardType);
                    }

                    if ("1".Equals(AccountType))
                    {
                        AccountType = "资金账户";
                    }
                    else if ("2".Equals(AccountType))
                    {
                        AccountType = "脱机账户";
                    }
                    else if ("3".Equals(AccountType))
                    {
                        AccountType = "代金券账户";
                    }
                    else if ("4".Equals(AccountType))
                    {
                        AccountType = "积分账户";
                    }

                    if ("0".Equals(AccountStatus))
                    {
                        AccountStatus = "未激活";
                    }
                    else if ("1".Equals(AccountStatus))
                    {
                        AccountStatus = "正常";
                    }
                    else if ("2".Equals(AccountStatus))
                    {
                        AccountStatus = "挂失";
                    }
                    else if ("3".Equals(AccountStatus))
                    {
                        AccountStatus = "冻结";
                    }
                    else if ("4".Equals(AccountStatus))
                    {
                        AccountStatus = "锁定";
                    }
                    else if ("9".Equals(AccountStatus))
                    {
                        AccountStatus = "已销户";
                    }
                    else
                    { //为定义
                        AccountStatus = "未定义";
                    }

                    //客户信息查询
                    ResultQueryCustInfo = CustBasicInfo.getCustInfo(SPID, CustID, out ErrMsg, out OuterID, out Status, out CustType,
                                                  out CustLevel, out RealName, out UserName, out NickName, out CertificateCode,
                                                  out CertificateType, out Sex, out Email, out EnterpriseID, out ProvinceID, out AreaID, out Registration);

                    if (ResultQueryCustInfo == 0)
                    {
                        logger.Info("AccountInfoQuery_log:客户信息查询成功!");
                    }
                    else
                    {
                        ResponseMsg.Length = 0;
                        if ("json".Equals(wt))
                        {
                            ResponseMsg.Append("{");
                            ResponseMsg.AppendFormat("\"errcode\":\"{0}\",", "999");
                            ResponseMsg.AppendFormat("\"errmsg\":\"{0}\"", "客户信息查询失败");
                            ResponseMsg.Append("}");
                        }
                        else
                        {
                            ResponseMsg.Append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
                            ResponseMsg.Append("<PayPlatRequestParameter>");
                            ResponseMsg.Append("<PARAMETERS>");
                            ResponseMsg.AppendFormat("<ErrCode>{0}</ErrCode>", "999");
                            ResponseMsg.AppendFormat("<ErrMsg>{0}</ErrMsg>", "客户信息查询失败");
                            ResponseMsg.Append("</PARAMETERS>");
                            ResponseMsg.Append("</PayPlatRequestParameter>");
                        }
                        logger.Info("AccountInfoQuery_log:客户信息查询失败!");
                        return ResponseMsg.ToString();
                    }

                    if (Result == 0 && ResultQueryCustInfo == 0)
                    {
                        ResponseMsg.Length = 0;
                        if ("json".Equals(wt))  // 以json格式 返回
                        {
                            ResponseMsg.Append("{");
                            ResponseMsg.AppendFormat("\"AccountNo\":\"{0}\",", AccountNo);
                            ResponseMsg.AppendFormat("\"AccountName\":\"{0}\",", AccountName);
                            ResponseMsg.AppendFormat("\"BesttoneAccount\":\"{0}\",", entity.BestPayAccount);
                            ResponseMsg.AppendFormat("\"RealName\":\"{0}\",", RealName);
                            ResponseMsg.AppendFormat("\"UserName\":\"{0}\",", UserName);
                            ResponseMsg.AppendFormat("\"NickName\":\"{0}\",", NickName);
                            ResponseMsg.AppendFormat("\"Sex\":\"{0}\",", Sex);
                            ResponseMsg.AppendFormat("\"AccountType\":\"{0}\",", AccountType);
                            ResponseMsg.AppendFormat("\"AccountStatus\":\"{0}\",", AccountStatus);
                            ResponseMsg.AppendFormat("\"AccountBalance\":\"{0}\",", AccountBalance);
                            ResponseMsg.AppendFormat("\"PredayBalance\":\"{0}\",", PredayBalance);
                            ResponseMsg.AppendFormat("\"PreMonthBalance\":\"{0}\",", PreMonthBalance);
                            ResponseMsg.AppendFormat("\"AvailableBalance\":\"{0}\",", AvailableBalance);
                            ResponseMsg.AppendFormat("\"UnAvailableBalance\":\"{0}\",", UnAvailableBalance);
                            ResponseMsg.AppendFormat("\"AvailableLecash\":\"{0}\",", AvailableLecash);
                            ResponseMsg.AppendFormat("\"CardNum\":\"{0}\",", CardNum);
                            ResponseMsg.AppendFormat("\"CardType\":\"{0}\"", CardType);
                            ResponseMsg.Append("}");
                        }
                        else
                        {  //  以 xml 格式返回
                            ResponseMsg.Append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
                            ResponseMsg.Append("<PayPlatRequestParameter>");
                            ResponseMsg.Append("<PARAMETERS>");
                            ResponseMsg.AppendFormat("<ErrCode>{0}</ErrCode>");
                            ResponseMsg.AppendFormat("<AccountNo>{0}</AccountNo>", AccountNo);
                            ResponseMsg.AppendFormat("<AccountName>{0}</AccountName>", AccountName);

                            ResponseMsg.AppendFormat("<RealName>{0}</RealName>", RealName);
                            ResponseMsg.AppendFormat("<UserName>{0}</UserName>", AccountName);
                            ResponseMsg.AppendFormat("<NickName>{0}</NickName>", AccountName);
                            ResponseMsg.AppendFormat("<Sex>{0}</Sex>", AccountName);

                            ResponseMsg.AppendFormat("<AccountType>{0}</AccountType>", AccountType);
                            ResponseMsg.AppendFormat("<AccountStatus>{0}</AccountStatus>", AccountStatus);
                            ResponseMsg.AppendFormat("<AccountBalance>{0}</AccountBalance>", AccountBalance);
                            ResponseMsg.AppendFormat("<PredayBalance>{0}</PredayBalance>", PredayBalance);
                            ResponseMsg.AppendFormat("<PreMonthBalance>{0}</PreMonthBalance>", PreMonthBalance);
                            ResponseMsg.AppendFormat("<AvailableBalance>{0}</AvailableBalance>", AvailableBalance);
                            ResponseMsg.AppendFormat("<UnAvailableBalance>{0}</UnAvailableBalance>", UnAvailableBalance);
                            ResponseMsg.AppendFormat("<AvailableLecash>{0}</AvailableLecash>", AvailableLecash);
                            ResponseMsg.AppendFormat("<CardNum>{0}</CardNum>", CardNum);
                            ResponseMsg.AppendFormat("<CardType>{0}</CardType>", CardType);
                            ResponseMsg.Append("</PARAMETERS>");
                            ResponseMsg.Append("</PayPlatRequestParameter>");
                        }
                    }

                }
                else
                {
                    // 返回错误信息
                    ResponseMsg.Length = 0;
                    if ("json".Equals(wt))
                    {

                        ResponseMsg.Append("{");
                        ResponseMsg.AppendFormat("\"errcode\":\"{0}\",", "999");
                        ResponseMsg.AppendFormat("\"errmsg\":\"{0}\"", "账户查询失败");
                        ResponseMsg.Append("}");
                    }
                    else
                    {
                        ResponseMsg.Append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
                        ResponseMsg.Append("<PayPlatRequestParameter>");
                        ResponseMsg.Append("<PARAMETERS>");
                        ResponseMsg.AppendFormat("<ErrCode>{0}</ErrCode>", "999");
                        ResponseMsg.AppendFormat("<ErrMsg>{0}</ErrMsg>", "账户查询失败");
                        ResponseMsg.Append("</PARAMETERS>");
                        ResponseMsg.Append("</PayPlatRequestParameter>");
                    }

                    logger.Info("AccountInfoQuery_log:账户查询失败!");
                }

            }

        }
        catch (Exception ex)
        {
            logger.Info(ex.Message);

        }
        return ResponseMsg.ToString();
    }