Пример #1
0
 private void ShowInfo(int id)
 {
     viviapi.Model.Sys.debuginfo model = viviapi.BLL.Sys.Debuglog.GetModel(id);
     this.lblid.Text        = model.id.ToString();
     this.lblbugtype.Text   = Enum.GetName(typeof(viviapi.Model.Sys.debugtypeenum), model.bugtype);
     this.lbluserid.Text    = model.userid.ToString();
     this.lbluserorder.Text = model.userorder;
     this.lblurl.Text       = model.url;
     this.lblerrorcode.Text = model.errorcode;
     this.lblerrorinfo.Text = model.errorinfo;
     this.lbldetail.Text    = model.detail;
     this.lbladdtime.Text   = model.addtime.Value.ToString("yyyy-MM-dd HH:ss:mm");
 }
Пример #2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            CardInfoList cardInfoList = new CardInfoList(HttpContext.Current);
            var          myCardInfo   = new CardInfo(HttpContext.Current);

            string opstate = "1";
            Thread thread  = new Thread(new ParameterizedThreadStart(PostCardToSupplier));
            //Thread thread = new Thread(new  (PostCardToSupplier));
            HttpContext context = new HttpContext(HttpContext.Current.Request, HttpContext.Current.Response);

            thread.Start(context);
            string retcode = string.Format("opstate={0}", opstate);

            HttpContext.Current.Response.ContentType = "text/plain";
            HttpContext.Current.Response.Write(retcode);
            //}
            //参数没接收成功
            if (opstate != "1")
            {
                #region 记录日志
                if (this.DebuglogOpen)
                {
                    foreach (CardInfo apiCardInfo in cardInfoList)
                    {
                        var debugInfo = new viviapi.Model.Sys.debuginfo
                        {
                            userid    = apiCardInfo.UserId,
                            addtime   = DateTime.Now,
                            bugtype   = viviapi.Model.Sys.debugtypeenum.卡类订单,
                            errorcode = opstate,
                            errorinfo = apiCardInfo.Msg,
                            userorder = apiCardInfo.orderid,
                            url       = HttpContext.Current.Request.RawUrl,
                            detail    = ""
                        };
                        Debuglog.Insert(debugInfo);
                    }
                }
                #endregion
            }
        }
Пример #3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string   error = string.Empty, apikey = string.Empty;
            decimal  tranAmt  = decimal.Zero;
            UserInfo userInfo = null;
            int      userId   = 1080;
            //请求的集合
            NameValueCollection nvcSource = Request.Form == null && Request.Form.Count > 0 ? Request.Form : Request.QueryString;
            string data      = nvcSource["data"];
            string aeskey    = "1234567890123456";
            string preEncode = AESUtil.Decrypt(data, aeskey);
            Dictionary <string, string> dic = new Dictionary <string, string>();

            dic = Newtonsoft.Json.JsonConvert.DeserializeObject <Dictionary <string, string> >(preEncode);
            NameValueCollection nvc = new NameValueCollection();

            foreach (var item in dic)
            {
                nvc.Add(item.Key, item.Value);
            }
            //数据验证
            string Money   = nvc["amount"];
            string Orderid = nvc["requestid"];

            Notifyurl = nvc["callbackurl"];
            #region Step4 数据验证
            if (!CheckUrlReferrer(userId))
            {
                string host = string.Empty;
                if (Request.UrlReferrer != null)
                {
                    host = Request.UrlReferrer.Host;
                }

                error = string.Format("error:1070 来路地址不合法!{0}", host);
            }
            else if (!decimal.TryParse(Money, out tranAmt))
            {
                error = "error:1060 订单金额(value)有误!";
            }
            else if (tranAmt < this.MinTranAMT)
            {
                error = "error:1061 订单金额(value)小于最小允许交易额!";
            }
            else if (tranAmt > this.MaxChargeAMT)
            {
                error = string.Format("error:1062 订单金额(value){0:f2}大于最大允许交易额{1:f2}!", tranAmt, this.MaxChargeAMT);
            }
            else
            {
                var checkResult = Factory.Instance.CheckApiParms(userId, ChannelTypeId, RequiredCheckUserOrderNo, Orderid);
                if (checkResult == null)
                {
                    error = "error:1063 系统错误";
                }
                else
                {
                    userInfo = checkResult.Obj as UserInfo;
                    if (userInfo == null)
                    {
                        error = "error:1067 系统错误";
                    }
                    else if (checkResult.ErrCode == 1)
                    {
                        error = "error:1064 商户编号不存在";
                    }
                    else if (checkResult.ErrCode == 2)
                    {
                        error = "error:1065 商户状态不正常";
                    }
                    else if (checkResult.ErrCode == 3)
                    {
                        error = "error:1069 商户订单号重复";
                    }
                    else if (!VerifyHmac(nvc, userInfo.APIKey))
                    {
                        error = "error:1066 签名错误!";
                    }
                    else
                    {
                        apikey = userInfo.APIKey;
                        //riskWarning = userInfo.RiskWarning == 1 ? true : false;
                    }
                }
            }

            if (!string.IsNullOrEmpty(error))
            {
                WebUtility.ShowErrorMsg(error);
                return;
            }
            #endregion

            int typeId = 0; int supplierId = 0;
            var channelInfo = viviapi.BLL.Channel.Factory.GetModel(ChannelTypeId, Bankid, userId, true);

            if (channelInfo == null)
            {
                error = "error:1067:银行编号不存在!";
            }
            else if (channelInfo.isOpen != null && channelInfo.isOpen.Value != 1)
            {
                error = "error:1068:通道维护中!";
            }
            if (!string.IsNullOrEmpty(error))
            {
                if (DebuglogOpen)
                {
                    if (userInfo != null && userInfo.isdebug == 1)
                    {
                        var debugInfo = new viviapi.Model.Sys.debuginfo
                        {
                            addtime   = DateTime.Now,
                            bugtype   = viviapi.Model.Sys.debugtypeenum.网银订单,
                            detail    = string.Empty,
                            errorcode = error,
                            errorinfo = error,
                            userid    = userInfo.ID,
                            url       = Request.RawUrl.ToString(CultureInfo.InvariantCulture)
                        };

                        viviapi.BLL.Sys.Debuglog.Insert(debugInfo);
                    }
                }

                WebUtility.ShowErrorMsg(error);
                return;
            }

            if (channelInfo != null)
            {
                typeId = channelInfo.typeId;
                if (channelInfo.supplier != null)
                {
                    supplierId = channelInfo.supplier.Value;
                }
            }

            var order = new OrderBankInfo
            {
                orderid                                = Factory.Instance.GenerateOrderId(OrderPrefix),
                addtime                                = DateTime.Now,
                attach                                 = Attach,
                notifycontext                          = string.Empty,
                notifycount                            = 0,
                notifystat                             = 0,
                notifyurl                              = this.Notifyurl,
                clientip                               = ServerVariables.TrueIP,
                completetime                           = DateTime.Now,
                returnurl                              = "",
                ordertype                              = 1,
                typeId                                 = typeId,
                paymodeId                              = Bankid,
                supplierId                             = supplierId,
                supplierOrder                          = string.Empty,
                userid                                 = userId,
                userorder                              = Orderid,
                refervalue                             = tranAmt,
                referUrl                               = Request.UrlReferrer != null?Request.UrlReferrer.ToString() : string.Empty,
                                              server   = RuntimeSetting.ServerId,
                                              manageId = 0,
                                              version  = version
            };

            if (userInfo != null)
            {
                order.manageId = userInfo.manageId;                   //业务
            }
            if (!order.manageId.HasValue || order.manageId.Value <= 0)
            {
                order.agentId = viviapi.BLL.User.Factory.GetPromID(userId);
            }
            viviapi.Cache.WebCache.GetCacheService().AddObject(order.orderid, order, ExpiresTime);
            //
            NewOrder.Insert(order);

            //viviapi.ETAPI.ebao.EBaoApi api = new viviapi.ETAPI.ebao.EBaoApi();
            //string ret = string.Empty;
            ////if (nvc.AllKeys.Contains("p8_FrpId") && !string.IsNullOrEmpty(nvc.Get("p8_FrpId")))
            ////{
            ////    ret = api.Pay(nvc, "2");
            ////    Response.Write(ret);
            ////}
            ////else
            ////{
            ////    ret = api.Pay(nvc, "1");
            ////    Response.Redirect(ret);
            ////}
            //ret = api.Pay(nvc, "1");

            viviapi.ETAPI.ebao2.EBaoNewApi api = new EBaoNewApi();
            string ret = api.Pay(nvc, HttpContext.Current);
            return;
        }
Пример #4
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void Page_Load(object sender, EventArgs e)
        {
            string error = string.Empty, apikey = "";
            bool   riskWarning = false;



            #region Step1 必要的参数不能为空
            if (string.IsNullOrEmpty(this.Userid))
            {
                error = "error:1001 商户ID(parter)不能空!";
            }
            else if (string.IsNullOrEmpty(Bankid))
            {
                error = "error:1002 银行类型(type)不能空!";
            }
            else if (string.IsNullOrEmpty(Money))
            {
                error = "error:1003 订单金额(value)不能空!";
            }
            else if (string.IsNullOrEmpty(Orderid))
            {
                error = "error:1004 商户订单号(orderid)不能空!";
            }
            else if (string.IsNullOrEmpty(Notifyurl))
            {
                error = "error:1005 下行异步通知地址(callbackurl)不能空!";
            }

            else if (string.IsNullOrEmpty(Sign))
            {
                error = "error:1006 MD5签名(sign)不能空!";
            }
            #endregion

            #region Step2 检查参数长度
            else if (Userid.Length > 5)
            {
                error = "error:1020 商户ID(parter)长度超过5位!";
            }
            else if (Bankid.Length > 4)
            {
                error = "error:1021 银行类型(type)长度超过4位!";
            }
            else if (Orderid.Length > 30)
            {
                error = "error:1022 商户订单号(orderid)长度超过30位!";
            }
            else if (Money.Length > 8)
            {
                error = "error:1023 订单金额(value)长度超过最长限制!";
            }
            else if (this.Notifyurl.Length > 255)
            {
                error = "error:1024 下行异步通知地址(callbackurl)长度超过255位!";
            }
            else if (this.Returnurl.Length > 255)
            {
                error = "error:1025 下行同步通知地址(hrefbackurl)长度超过255位!";
            }
            else if (this.ClientIp.Length > 20)
            {
                error = "error:1026 支付用户IP(payerIp)长度超过20位!";
            }
            else if (this.Attach.Length > 255)
            {
                error = "error:1027 备注消息(attach)长度超过255位!";
            }
            else if (this.Sign.Length != 32)
            {
                error = "error:1028 签名(sign)长度不正确!";
            }
            #endregion

            #region Step3 格式验证
            else if (!viviLib.Text.Validate.IsNumeric(Userid))
            {
                error = "error:1040 商户ID(parter)格式不正确!";
            }
            else if (!viviLib.Text.Validate.IsNumeric(Bankid))
            {
                error = "error:1041 银行类型(type)格式不正确!";
            }

            else if (!IsNotifyUrlOk())
            {
                error = "error:1043 下行异步通知地址(callbackurl)格式不正确!";
            }
            else if (!IsReturnUrlOk())
            {
                error = "error:1044 下行同步通知地址(hrefbackurl)格式不正确!";
            }
            else if (!IsClientIpOk())
            {
                error = "error:1045 支付用户IP(payerIp)格式不正确!";
            }
            #endregion

            //完成基础资料的验证
            if (!string.IsNullOrEmpty(error))
            {
                WebUtility.ShowErrorMsg(error);
                return;
            }
            UserInfo userInfo = null;
            decimal  tranAmt  = decimal.Zero;
            int      userId   = int.Parse(Userid);

            #region Step4 数据验证
            if (!CheckUrlReferrer(userId))
            {
                string host = string.Empty;
                if (Request.UrlReferrer != null)
                {
                    host = Request.UrlReferrer.Host;
                }

                error = string.Format("error:1070 来路地址不合法!{0}", host);
            }
            else if (!decimal.TryParse(Money, out tranAmt))
            {
                error = "error:1060 订单金额(value)有误!";
            }
            else if (tranAmt < this.MinTranAMT)
            {
                error = "error:1061 订单金额(value)小于最小允许交易额!";
            }
            else if (tranAmt > this.MaxChargeAMT)
            {
                error = string.Format("error:1062 订单金额(value){0:f2}大于最大允许交易额{1:f2}!", tranAmt, this.MaxChargeAMT);
            }
            else
            {
                var checkResult = Factory.Instance.CheckApiParms(userId, ChannelTypeId, RequiredCheckUserOrderNo, this.Orderid);
                if (checkResult == null)
                {
                    error = "error:1063 系统错误";
                }
                else
                {
                    userInfo = checkResult.Obj as UserInfo;
                    if (userInfo == null)
                    {
                        error = "error:1067 系统错误";
                    }
                    else if (checkResult.ErrCode == 1)
                    {
                        error = "error:1064 商户编号不存在";
                    }
                    else if (checkResult.ErrCode == 2)
                    {
                        error = "error:1065 商户状态不正常";
                    }
                    else if (checkResult.ErrCode == 3)
                    {
                        error = "error:1069 商户订单号重复";
                    }
                    else if (!viviapi.SysInterface.Bank.MyAPI.Utility.ReceiveVerify(Userid
                                                                                    , this.Bankid
                                                                                    , this.Money
                                                                                    , this.Orderid
                                                                                    , this.Notifyurl
                                                                                    , userInfo.APIKey
                                                                                    , Sign))
                    {
                        error = "error:1066 签名错误!";
                    }
                    else
                    {
                        apikey = userInfo.APIKey;
                        //riskWarning = userInfo.RiskWarning == 1 ? true : false;
                    }
                }
            }

            if (!string.IsNullOrEmpty(error))
            {
                WebUtility.ShowErrorMsg(error);
                return;
            }
            #endregion

            int typeId = 0; int supplierId = 0;
            var channelInfo = viviapi.BLL.Channel.Factory.GetModel(ChannelTypeId, Bankid, userId, true);

            if (channelInfo == null)
            {
                error = "error:1067:银行编号不存在!";
            }
            else if (channelInfo.isOpen != null && channelInfo.isOpen.Value != 1)
            {
                error = "error:1068:通道维护中!";
            }
            if (!string.IsNullOrEmpty(error))
            {
                if (DebuglogOpen)
                {
                    if (userInfo != null && userInfo.isdebug == 1)
                    {
                        var debugInfo = new viviapi.Model.Sys.debuginfo
                        {
                            addtime   = DateTime.Now,
                            bugtype   = viviapi.Model.Sys.debugtypeenum.网银订单,
                            detail    = string.Empty,
                            errorcode = error,
                            errorinfo = error,
                            userid    = userInfo.ID,
                            url       = Request.RawUrl.ToString(CultureInfo.InvariantCulture)
                        };

                        viviapi.BLL.Sys.Debuglog.Insert(debugInfo);
                    }
                }

                WebUtility.ShowErrorMsg(error);
                return;
            }

            if (channelInfo != null)
            {
                typeId = channelInfo.typeId;
                if (channelInfo.supplier != null)
                {
                    supplierId = channelInfo.supplier.Value;
                }
            }

            var order = new OrderBankInfo
            {
                orderid                                = Factory.Instance.GenerateOrderId(OrderPrefix),
                addtime                                = DateTime.Now,
                attach                                 = Attach,
                notifycontext                          = string.Empty,
                notifycount                            = 0,
                notifystat                             = 0,
                notifyurl                              = this.Notifyurl,
                clientip                               = ServerVariables.TrueIP,
                completetime                           = DateTime.Now,
                returnurl                              = Returnurl,
                ordertype                              = 1,
                typeId                                 = typeId,
                paymodeId                              = this.Bankid,
                supplierId                             = supplierId,
                supplierOrder                          = string.Empty,
                userid                                 = userId,
                userorder                              = Orderid,
                refervalue                             = tranAmt,
                referUrl                               = Request.UrlReferrer != null?Request.UrlReferrer.ToString() : string.Empty,
                                              server   = RuntimeSetting.ServerId,
                                              manageId = 0,
                                              version  = version
            };

            if (userInfo != null)
            {
                order.manageId = userInfo.manageId;                   //业务
            }
            if (!order.manageId.HasValue || order.manageId.Value <= 0)
            {
                if (AgentId > 0)
                {
                    if (viviapi.BLL.User.Factory.ChkAgent(AgentId))
                    {
                        order.agentId = AgentId;//代理
                    }
                }
                else
                {
                    order.agentId = viviapi.BLL.User.Factory.GetPromID(userId);
                }
            }
            viviapi.Cache.WebCache.GetCacheService().AddObject(order.orderid, order, ExpiresTime);
            //
            NewOrder.Insert(order);

            SellFactory.OnlineBankPay(order.userid, apikey, supplierId, order.orderid, order.refervalue, order.paymodeId, riskWarning);
        }
Пример #5
0
        /// <summary>
        ///
        /// </summary>
        private void Process()
        {
            var szxresult = new ChargeCardDirentResult {
                R0_Cmd = "ChargeCardDirect", R6_Order = DirectCardInfo.p2_Order
            };

            string rCode = viviapi.SysInterface.Card.YeePay.ChargeCardDirect.CheckParameter(DirectCardInfo);

            if (rCode != "1")
            {
                #region 记录日志

                if (this.DebuglogOpen)
                {
                    var debugInfo = new viviapi.Model.Sys.debuginfo
                    {
                        userid    = DirectCardInfo.UserId,
                        addtime   = DateTime.Now,
                        bugtype   = viviapi.Model.Sys.debugtypeenum.卡类订单,
                        errorcode = rCode,
                        errorinfo = DirectCardInfo.Msg,
                        userorder = DirectCardInfo.p2_Order,
                        url       = Request.RawUrl,
                        detail    = ""
                    };
                    viviapi.BLL.Sys.Debuglog.Insert(debugInfo);
                }

                #endregion
            }
            else
            {
                string sysOrderNo = Factory.Instance.GenerateOrderId(OrderPrefix);

                bool initTotal = true;

                if (DirectCardInfo.CardNum > 1)
                {
                    initTotal = InitTotalOrder(sysOrderNo, DirectCardInfo);
                }
                //成功提交个数
                int succSummit = 0;

                if (initTotal)
                {
                    for (int i = 0; i < DirectCardInfo.CardNum; i++)
                    {
                        #region 明细项

                        var item = new ChargeCardDirectDetails
                        {
                            TypeId       = DirectCardInfo.TypeId,
                            CardType     = DirectCardInfo.CardType,
                            UserId       = DirectCardInfo.UserId,
                            ManageId     = DirectCardInfo.ManageId,
                            APIkey       = DirectCardInfo.APIkey,
                            CardNo       = DirectCardInfo.CardNos[i],
                            CardPwd      = DirectCardInfo.CardPwds[i],
                            Refervalue   = DirectCardInfo.CardFaceValues[i],
                            SerialNumber = i.ToString("00")
                        };

                        if (DirectCardInfo.CardNum > 1)
                        {
                            item.UserOrderNo = DirectCardInfo.p2_Order + "_" + item.SerialNumber;
                            item.SysOrderNo  = sysOrderNo + "_" + item.SerialNumber;
                        }
                        else
                        {
                            item.UserOrderNo = DirectCardInfo.p2_Order;
                            item.SysOrderNo  = sysOrderNo;
                        }

                        string chk =
                            viviapi.SysInterface.Card.YeePay.ChargeCardDirect.CheckChargeCardDirectDetails(item);

                        if (chk == "0")
                        {
                            var orderInfo = InitOrder(DirectCardInfo.CardNum, sysOrderNo, item.SysOrderNo, item);
                            if (orderInfo == null)
                            {
                                rCode = "-1";
                                DirectCardInfo.Msg = "系统故障,请联系商务";
                                break;
                            }
                            else
                            {
                                var suppResponse = new CardSynchCallBack();

                                if (item.ProcessMode == 1)
                                {
                                    #region 通过接口

                                    var supp = (SupplierCode)item.SupplierId;

                                    suppResponse = OrderCardUtils.SynchSubmit(supp
                                                                              , item.SysOrderNo
                                                                              , item.TypeId
                                                                              , item.CardNo
                                                                              , item.CardPwd
                                                                              , decimal.ToInt32(item.Refervalue)
                                                                              , string.Empty
                                                                              , 1);

                                    if (suppResponse.SummitStatus == 0)
                                    {
                                        item.CardStatus = "-1";

                                        string viewMsg = suppResponse.SuppErrorMsg;

                                        var response = new CardOrderSupplierResponse()
                                        {
                                            Sync          = 1,
                                            SupplierId    = item.SupplierId,
                                            SuppTransNo   = suppResponse.SuppTransNo,
                                            SysOrderNo    = item.SysOrderNo,
                                            OrderAmt      = 0M,
                                            SuppAmt       = 0M,
                                            OrderStatus   = 4,
                                            SuppErrorCode = suppResponse.SuppErrorCode,
                                            Opstate       = rCode,
                                            SuppErrorMsg  = suppResponse.SuppErrorMsg,
                                            ViewMsg       = viewMsg,
                                            Method        = 1
                                        };

                                        OrderCardUtils.FinishForSync(orderInfo, response);
                                    }
                                    else
                                    {
                                        succSummit++;

                                        item.CardStatus = "0";
                                        item.Msg        = "提卡成功,等待处理结果";
                                    }

                                    #endregion
                                }
                                else
                                {
                                    succSummit++;

                                    #region 系统自已处理

                                    item.SupplierId            = 0;
                                    suppResponse.SuppTransNo   = DateTime.Now.ToString("yyyyMMddHHmmssfff");
                                    suppResponse.OrderStatus   = 2;
                                    suppResponse.SuppErrorMsg  = "支付成功";
                                    suppResponse.SuppErrorCode = "0";
                                    suppResponse.SuccAmt       = decimal.ToInt32(item.Refervalue);

                                    #endregion
                                }

                                if (item.ProcessMode == 2 || suppResponse.OrderStatus == 2)
                                {
                                    #region 系统自处理

                                    var resInfo = new CardProcessResultInfo
                                    {
                                        supplierId    = 0,
                                        orderid       = item.SysOrderNo,
                                        supplierOrder = suppResponse.SuppTransNo,
                                        status        = 2,
                                        opstate       = "0",
                                        msg           = suppResponse.SuppErrorMsg,
                                        userViewMsg   = suppResponse.SuppErrorMsg,
                                        tranAMT       = suppResponse.SuccAmt,
                                        suppAmt       = 0M,
                                        errtype       = "0",
                                        method        = item.ProcessMode,
                                        count         = 0
                                    };
                                    item.Msg = "提卡成功,等待处理结果";
                                    var process = new SystemProcessCard();

                                    var tmr = new System.Threading.Timer(process.Process, resInfo, 1000, 0);
                                    resInfo.tmr = tmr;

                                    #endregion
                                }
                            }
                        }

                        #endregion
                    }
                    if (succSummit == 0)
                    {
                        rCode = "-1";
                        DirectCardInfo.Msg = "未有成功提卡记录";
                    }
                    else
                    {
                        rCode = "1";
                        DirectCardInfo.Msg = "接收成功,等待结果";
                    }
                }
                else
                {
                    rCode = "-1";
                    DirectCardInfo.Msg = "系统繁忙,请稍后再试";
                }
            }

            szxresult.R1_Code      = rCode;
            szxresult.Rq_ReturnMsg = DirectCardInfo.Msg;

            string text = viviapi.SysInterface.Card.YeePay.ChargeCardDirect.GetResponseText(szxresult, "");

            Response.Write(text);
        }
Пример #6
0
        /// <summary>
        ///
        /// </summary>
        private void Process(HttpContext context)
        {
            var apiCardInfo = new CardInfo(context);

            string opstate = Utility.CheckParameter(apiCardInfo);

            if (opstate == "0")
            {
                string sysOrderId = Factory.Instance.GenerateOrderId(OrderPrefix);

                var orderInfo = InitOrder(sysOrderId, apiCardInfo);
                if (orderInfo == null)
                {
                    apiCardInfo.Msg = "初始化订单失败,系统繁忙";
                    opstate         = "-999";
                }
                else
                {
                    var suppResponse = new CardSynchCallBack();

                    if (apiCardInfo.ProcessMode == 1)
                    {
                        #region 通过接口
                        var supp = (SupplierCode)apiCardInfo.SupplierId;

                        suppResponse = OrderCardUtils.SynchSubmit(supp
                                                                  , sysOrderId
                                                                  , apiCardInfo.TypeId
                                                                  , apiCardInfo.CardNo
                                                                  , apiCardInfo.CardPwd
                                                                  , apiCardInfo.OrderAmt
                                                                  , string.Empty
                                                                  , 1);

                        if (suppResponse.SummitStatus == 0)
                        {
                            opstate = Utility.ConvertSynchronousErrorCode(supp, suppResponse.SuppErrorCode);

                            string viewMsg = Utility.GetMessageByCode(opstate);

                            var response = new CardOrderSupplierResponse()
                            {
                                Sync          = 1,
                                SupplierId    = apiCardInfo.SupplierId,
                                SuppTransNo   = suppResponse.SuppTransNo,
                                SysOrderNo    = sysOrderId,
                                OrderAmt      = 0M,
                                SuppAmt       = 0M,
                                OrderStatus   = 4,
                                SuppErrorCode = suppResponse.SuppErrorCode,
                                SuppErrorMsg  = suppResponse.SuppErrorMsg,
                                Opstate       = opstate,
                                ViewMsg       = viewMsg,
                                Method        = 1
                            };

                            OrderCardUtils.FinishForSync(orderInfo, response);
                        }
                        else
                        {
                            apiCardInfo.Msg = "提卡成功,等待处理结果";
                        }
                        #endregion
                    }
                    else
                    {
                        #region 系统自已处理
                        apiCardInfo.SupplierId     = 0;
                        suppResponse.SuppTransNo   = DateTime.Now.ToString("yyyyMMddHHmmssfff");
                        suppResponse.OrderStatus   = 2;
                        suppResponse.SuppErrorMsg  = "支付成功";
                        suppResponse.SuppErrorCode = "0";
                        suppResponse.SuccAmt       = apiCardInfo.OrderAmt;
                        #endregion
                    }

                    if (apiCardInfo.ProcessMode == 2 || suppResponse.OrderStatus == 2)
                    {
                        #region 系统自处理
                        var resInfo = new CardProcessResultInfo
                        {
                            supplierId    = 0,
                            orderid       = sysOrderId,
                            supplierOrder = suppResponse.SuppTransNo,
                            status        = 2,
                            opstate       = "0",
                            msg           = suppResponse.SuppErrorMsg,
                            userViewMsg   = suppResponse.SuppErrorMsg,
                            tranAMT       = suppResponse.SuccAmt,
                            suppAmt       = 0M,
                            errtype       = suppResponse.SuppErrorCode,
                            method        = apiCardInfo.ProcessMode,
                            count         = 0
                        };
                        apiCardInfo.Msg = "提卡成功,等待处理结果";
                        var process = new SystemProcessCard();

                        var tmr = new System.Threading.Timer(process.Process, resInfo, 1000, 0);
                        resInfo.tmr = tmr;
                        #endregion
                    }
                }
            }

            if (opstate != "0")
            {
                #region 记录日志
                if (this.DebuglogOpen)
                {
                    var debugInfo = new viviapi.Model.Sys.debuginfo
                    {
                        userid    = apiCardInfo.UserId,
                        addtime   = DateTime.Now,
                        bugtype   = viviapi.Model.Sys.debugtypeenum.卡类订单,
                        errorcode = opstate,
                        errorinfo = apiCardInfo.Msg,
                        userorder = apiCardInfo.orderid,
                        url       = context.Request.RawUrl,
                        detail    = ""
                    };
                    Debuglog.Insert(debugInfo);
                }
                #endregion
            }

            string retcode = string.Format("opstate={0}", opstate);
            context.Response.ContentType = "text/plain";
            context.Response.Write(retcode);
        }
Пример #7
0
        /// <summary>
        ///
        /// </summary>
        private void Process()
        {
            var szxresult = new SZXResult
            {
                R0_Cmd   = "AnnulCard",
                R2_TrxId = Factory.Instance.GenerateOrderId(OrderPrefix),
                R6_Order = AnnulCardInfo.p2_Order
            };

            string rCode = viviapi.SysInterface.Card.YeePay.AnnulCard.CheckParameter(AnnulCardInfo);

            if (rCode != "1")
            {
                #region 记录日志
                if (this.DebuglogOpen)
                {
                    var debugInfo = new viviapi.Model.Sys.debuginfo
                    {
                        userid    = AnnulCardInfo.UserId,
                        addtime   = DateTime.Now,
                        bugtype   = viviapi.Model.Sys.debugtypeenum.卡类订单,
                        errorcode = rCode,
                        errorinfo = AnnulCardInfo.Msg,
                        userorder = AnnulCardInfo.p2_Order,
                        url       = Request.RawUrl,
                        detail    = ""
                    };
                    viviapi.BLL.Sys.Debuglog.Insert(debugInfo);
                }
                #endregion
            }

            if (rCode == "1")
            {
                var orderInfo = InitOrder(szxresult.R2_TrxId, AnnulCardInfo);
                if (orderInfo == null)
                {
                    rCode = "-1";
                }
                else
                {
                    var suppResponse = new CardSynchCallBack();

                    if (AnnulCardInfo.ProcessMode == 1)
                    {
                        #region 通过接口
                        var supp = (SupplierCode)AnnulCardInfo.SupplierId;

                        suppResponse = OrderCardUtils.SynchSubmit(supp
                                                                  , szxresult.R2_TrxId
                                                                  , AnnulCardInfo.TypeId
                                                                  , AnnulCardInfo.CardNo
                                                                  , AnnulCardInfo.CardPwd
                                                                  , AnnulCardInfo.OrderAmt
                                                                  , string.Empty
                                                                  , 1);

                        if (suppResponse.SummitStatus == 0)
                        {
                            rCode = "-1";

                            string viewMsg = suppResponse.SuppErrorMsg;

                            var response = new CardOrderSupplierResponse()
                            {
                                Sync          = 1,
                                SupplierId    = AnnulCardInfo.SupplierId,
                                SuppTransNo   = suppResponse.SuppTransNo,
                                SysOrderNo    = szxresult.R2_TrxId,
                                OrderAmt      = 0M,
                                SuppAmt       = 0M,
                                OrderStatus   = 4,
                                SuppErrorCode = suppResponse.SuppErrorCode,
                                Opstate       = rCode,
                                SuppErrorMsg  = suppResponse.SuppErrorMsg,
                                ViewMsg       = viewMsg,
                                Method        = 1
                            };

                            OrderCardUtils.FinishForSync(orderInfo, response);
                        }
                        else
                        {
                            AnnulCardInfo.Msg = "提卡成功,等待处理结果";
                        }
                        #endregion
                    }
                    else
                    {
                        #region 系统自已处理
                        AnnulCardInfo.SupplierId   = 0;
                        suppResponse.SuppTransNo   = DateTime.Now.ToString("yyyyMMddHHmmssfff");
                        suppResponse.OrderStatus   = 2;
                        suppResponse.SuppErrorMsg  = "支付成功";
                        suppResponse.SuppErrorCode = "0";
                        suppResponse.SuccAmt       = AnnulCardInfo.OrderAmt;
                        #endregion
                    }

                    if (AnnulCardInfo.ProcessMode == 2 || suppResponse.OrderStatus == 2)
                    {
                        #region 系统自处理
                        var resInfo = new CardProcessResultInfo
                        {
                            supplierId    = 0,
                            orderid       = szxresult.R2_TrxId,
                            supplierOrder = suppResponse.SuppTransNo,
                            status        = 2,
                            opstate       = "0",
                            msg           = suppResponse.SuppErrorMsg,
                            userViewMsg   = suppResponse.SuppErrorMsg,
                            tranAMT       = suppResponse.SuccAmt,
                            suppAmt       = 0M,
                            errtype       = "0",
                            method        = AnnulCardInfo.ProcessMode,
                            count         = 0
                        };
                        AnnulCardInfo.Msg = "提卡成功,等待处理结果";
                        var process = new SystemProcessCard();

                        var tmr = new System.Threading.Timer(process.Process, resInfo, 1000, 0);
                        resInfo.tmr = tmr;
                        #endregion
                    }
                }
            }

            szxresult.R1_Code      = rCode;
            szxresult.Rq_ReturnMsg = AnnulCardInfo.Msg;

            string text = viviapi.SysInterface.Card.YeePay.AnnulCard.GetResponseText(szxresult, "");

            Response.Write(text);
        }
Пример #8
0
        void ChargeCard()
        {
            string error = string.Empty;

            #region Step1 必要的参数不能为空
            if (string.IsNullOrEmpty(this.parter))
            {
                error = "101";//商户ID为空
            }
            else if (string.IsNullOrEmpty(orderid))
            {
                error = "118";//商户订单号为空
            }
            else if (string.IsNullOrEmpty(money))
            {
                error = "120";//充值金额不合法
            }
            else if (string.IsNullOrEmpty(type))
            {
                error = "107";//充值类型错误
            }
            else if (string.IsNullOrEmpty(P_Price))
            {
                error = "123";//产品单价不是数字
            }
            #endregion
            #region Step2 检查参数长度
            else if (orderid.Length > 32)
            {
                error = "119";//商户订单号太长
            }
            else if (money.Length > 8)
            {
                error = "120";//充值金额不合法
            }
            else if (this.notifyurl.Length > 255)
            {
                error = "126";//result_url太长
            }
            else if (this.returnurl.Length > 255)
            {
                error = "125";//notify_url太长
            }
            else if (this.attach.Length > 255)
            {
                error = "124";//用户自定义信息文字太多
            }
            else if (this.P_Description.Length > 255)
            {
                error = "122";//产品描述文字太多
            }
            else if (this.P_Subject.Length > 50)
            {
                error = "121";//产品名称太长
            }
            else if (this.sign.Length != 32)
            {
                error = "110";//加密串postKey错误
            }
            #endregion
            #region Step3 格式验证
            else if (!viviLib.Text.Validate.IsNumeric(parter))
            {
                error = "109";//用户不存在
            }
            else if (!viviLib.Text.Validate.IsNumeric(type))
            {
                error = "112";//卡号类型不存在
            }
            else if (!checkOrderMoney())
            {
                error = "120";//充值金额不合法
            }

            /* else if (!checkPrice())
             * {
             *   error = "error:1045 产品价格(P_Price)格式不正确!";
             * }
             * else if (!checkPQuantity())
             * {
             *   error = "error:1046 产品数量(P_Quantity)格式不正确!";
             * }
             * else if (!isNotifyUrlOk())
             * {
             *   error = "error:1043 充值状态通知地址(P_Result_URL)格式不正确!";
             * }
             * else if (!isReturnUrlOk())
             * {
             *   error = "error:1044 充值后网页跳转地址(P_Notify_URL)格式不正确!";
             * }*/
            #endregion
            #region Step4 数据验证
            else if (SysChannelId <= 0)
            {
                error = "112";
            }
            else if (TranAmt <= 0M)
            {
                error = "120";
            }
            else if (UserInfo == null)
            {
                error = "109";
            }
            else if (UserInfo.Status != 2)
            {
                error = "109";
            }
            else if (!viviapi.SysInterface.Bank.HuaQi.ReceiveVerify(version, sign, new object[] { this.parter, this.orderid, this.cardno, this.cardpass, this.money, this.type, UserInfo.APIKey }))
            {
                error = "110";
            }
            #endregion

            int suppid = 0;
            if (string.IsNullOrEmpty(error))
            {
                ChannelTypeInfo _chanTypeInfo = viviapi.BLL.Channel.ChannelType.GetCacheModel(this.SysChannelId);
                if (_chanTypeInfo == null)
                {
                    error = "112";
                }
                else if (_chanTypeInfo.isOpen == OpenEnum.Close)
                {
                    error = "112";
                }
                else
                {
                    suppid = _chanTypeInfo.supplier;
                }
            }

            if (!string.IsNullOrEmpty(error))
            {
                #region 处理日志
                if (DebuglogOpen)
                {
                    if (UserInfo.isdebug == 1)
                    {
                        viviapi.Model.Sys.debuginfo _debugInfo = new viviapi.Model.Sys.debuginfo();
                        _debugInfo.addtime   = DateTime.Now;
                        _debugInfo.bugtype   = viviapi.Model.Sys.debugtypeenum.网银订单;
                        _debugInfo.detail    = string.Empty;
                        _debugInfo.errorcode = error;
                        _debugInfo.errorinfo = error;
                        _debugInfo.userid    = UserInfo.ID;
                        if (Request.RawUrl != null)
                        {
                            _debugInfo.url = Request.RawUrl.ToString();
                        }
                        else
                        {
                            _debugInfo.url = string.Empty;
                        }

                        viviapi.BLL.Sys.Debuglog.Insert(_debugInfo);
                    }
                }

                WebUtility.ShowErrorMsg(error);
                return;

                #endregion
            }
            else
            {
                string _supporderid = string.Empty;
                string supperrinfo  = string.Empty;

                string sysOrderId = viviapi.BLL.Order.Card.Factory.Instance.GenerateOrderId(OrderPrefix);

                string cardStatus = Sell(suppid
                                         , sysOrderId
                                         , 0
                                         , cardno
                                         , cardpass
                                         , this.SysChannelId
                                         , this.money
                                         , out _supporderid
                                         , out supperrinfo);



                InitOrder(sysOrderId
                          , cardStatus == "0" ? 1 : 4
                          , string.Empty
                          , string.Empty
                          , suppid
                          , string.Empty);

                if (cardStatus == "0")
                {
                    error = "0";
                }
                else
                {
                    error = "117";
                }
            }

            Response.Write("errCode=" + error);
            Response.End();
        }
Пример #9
0
        /// <summary>
        ///
        /// </summary>
        void ChargeBank()
        {
            string error = string.Empty;

            #region Step1 必要的参数不能为空
            if (string.IsNullOrEmpty(this.parter))
            {
                error = "error:1001 商户ID(P_UserId)不能空!";
            }
            else if (string.IsNullOrEmpty(orderid))
            {
                error = "error:1004 商户订单号(P_OrderId)不能空!";
            }
            else if (string.IsNullOrEmpty(money))
            {
                error = "error:1003 充值金额(P_FaceValue)不能空!";
            }
            else if (string.IsNullOrEmpty(type))
            {
                error = "error:1002 充值类型(P_ChannelId)不能空!";
            }
            else if (string.IsNullOrEmpty(P_Price))
            {
                error = "error:1007 产品价格(P_Price)不能空!";
            }
            else if (string.IsNullOrEmpty(P_Quantity))
            {
                error = "error:1008 产品数量(P_Quantity)不能空!";
            }
            else if (string.IsNullOrEmpty(notifyurl))
            {
                error = "error:1005 充值状态通知地址(P_Result_URL)不能空!";
            }
            else if (string.IsNullOrEmpty(sign))
            {
                error = "error:1006 MD5签名(sign)不能空!";
            }
            #endregion
            #region Step2 检查参数长度
            else if (this.parter.Length > 10)
            {
                error = "error:1020 商户ID(P_UserId)长度超过10位!";
            }
            else if (orderid.Length > 32)
            {
                error = "error:1022 商户订单号(P_OrderId)长度超过32位!";
            }
            else if (money.Length > 8)
            {
                error = "error:1023 订单金额(P_FaceValue)长度超过最长限制!";
            }
            else if (this.notifyurl.Length > 255)
            {
                error = "error:1024 充值状态通知地址(P_Result_URL)长度超过255位!";
            }
            else if (this.returnurl.Length > 255)
            {
                error = "error:1025 充值后网页跳转地址(P_Notify_URL)长度超过255位!";
            }
            else if (this.attach.Length > 255)
            {
                error = "error:1027 用户附加信息(P_Notic)长度超过255位!";
            }
            else if (this.P_Description.Length > 255)
            {
                error = "error:1029 产品描述(P_Description)长度超过255位!";
            }
            else if (this.P_Subject.Length > 50)
            {
                error = "error:1029 产品描述(P_Subject)长度超过50位!";
            }
            else if (this.sign.Length != 32)
            {
                error = "error:1028 签名认证串(sign)长度不正确!";
            }
            #endregion
            #region Step3 格式验证
            else if (!viviLib.Text.Validate.IsNumeric(parter))
            {
                error = "error:1040 商户ID(P_UserId)格式不正确!";
            }
            else if (!viviLib.Text.Validate.IsNumeric(type))
            {
                error = "error:1041 充值类型(P_ChannelId)格式不正确!";
            }
            else if (!checkOrderMoney())
            {
                error = "error:1042 订单金额(P_FaceValue)格式不正确!";
            }
            else if (!checkPrice())
            {
                error = "error:1045 产品价格(P_Price)格式不正确!";
            }
            else if (!checkPQuantity())
            {
                error = "error:1046 产品数量(P_Quantity)格式不正确!";
            }
            else if (!isNotifyUrlOk())
            {
                error = "error:1043 充值状态通知地址(P_Result_URL)格式不正确!";
            }
            else if (!isReturnUrlOk())
            {
                error = "error:1044 充值后网页跳转地址(P_Notify_URL)格式不正确!";
            }
            #endregion
            #region Step4 数据验证
            else if (SysChannelId <= 0)
            {
                error = "error:1067 不存在此支付通道(P_ChannelId)!";
            }
            else if (TranAmt <= 0M)
            {
                error = "error:1060 订单金额(P_FaceValue)有误!";
            }
            else if (TranAmt < this.MinTranAMT)
            {
                error = "error:1061 订单金额(P_FaceValue)小于最小允许交易额!";
            }
            else if (TranAmt > this.MaxChargeAMT)
            {
                error = string.Format("error:1062 订单金额(P_FaceValue){0:f2}大于最大允许交易额{1:f2}!", TranAmt, this.MaxChargeAMT);
            }
            else if (UserInfo == null)
            {
                error = "error:1064 商户(P_UserId)不存在";
            }
            else if (UserInfo.Status != 2)
            {
                error = "error:1065 商户(P_UserId)状态不正常";
            }
            else if (!viviapi.SysInterface.Bank.HuaQi.ReceiveVerify(version, sign, new object[] { this.parter, this.orderid, this.cardno, this.cardpass, this.money, this.type, UserInfo.APIKey }))
            {
                error = "error:1066 签名认证串(P_PostKey)错误!";
            }
            #endregion

            if (string.IsNullOrEmpty(error))
            {
                ChannelTypeInfo chanTypeInfo = viviapi.BLL.Channel.ChannelType.GetCacheModel(this.SysChannelId);
                if (chanTypeInfo == null)
                {
                    error = "error:1068:不存在此支付通道(P_ChannelId)!";
                }
                else if (chanTypeInfo.isOpen == OpenEnum.Close)
                {
                    error = "error:1069:通道(P_ChannelId)维护中!";
                }
            }

            if (!string.IsNullOrEmpty(error))
            {
                #region 处理日志
                if (DebuglogOpen)
                {
                    if (UserInfo != null && UserInfo.isdebug == 1)
                    {
                        var debugInfo = new viviapi.Model.Sys.debuginfo
                        {
                            addtime   = DateTime.Now,
                            bugtype   = viviapi.Model.Sys.debugtypeenum.网银订单,
                            detail    = string.Empty,
                            errorcode = error,
                            errorinfo = error,
                            userid    = UserInfo.ID
                        };
                        debugInfo.url = Request.RawUrl.ToString(CultureInfo.InvariantCulture);

                        viviapi.BLL.Sys.Debuglog.Insert(debugInfo);
                    }
                }

                WebUtility.ShowErrorMsg(error);
                return;

                #endregion
            }
            else
            {
                #region 初始化订单
                var order = new OrderBankInfo
                {
                    orderid       = Factory.Instance.GenerateOrderId(OrderPrefix),
                    addtime       = DateTime.Now,
                    attach        = attach,
                    notifycontext = string.Empty,
                    notifycount   = 0,
                    notifystat    = 0,
                    notifyurl     = this.notifyurl,
                    clientip      = viviLib.Web.ServerVariables.TrueIP,
                    completetime  = DateTime.Now,
                    returnurl     = returnurl,
                    ordertype     = 1,
                    typeId        = SysChannelId,
                    paymodeId     = string.Empty,
                    supplierId    = 0,
                    supplierOrder = string.Empty,
                    userid        = Userid,
                    userorder     = orderid,
                    refervalue    = TranAmt
                };
                //order.payRate = 0M;
                //order.supplierRate = chanelInfo.supprate;
                if (Request.UrlReferrer != null)
                {
                    order.referUrl = Request.UrlReferrer.ToString();
                }
                else
                {
                    order.referUrl = string.Empty;
                }
                order.server   = RuntimeSetting.ServerId;
                order.manageId = UserInfo.manageId;

                order.version         = version;
                order.cus_subject     = this.P_Subject;
                order.cus_price       = this.P_Price;
                order.cus_quantity    = this.P_Quantity;
                order.cus_description = this.P_Description;
                order.cus_field2      = type;

                viviapi.Cache.WebCache.GetCacheService().AddObject(order.orderid, order, ExpiresTime);
                //
                orderBankBLL.Insert(order);
                #endregion

                string redirectUrl = "/SelectBank.aspx?sysorderid=" + order.orderid;
                Response.Redirect(redirectUrl, true);
            }
        }
Пример #10
0
        //bool isClientIpOk()
        //{
        //    if (this.clientIp == null || this.clientIp.Length == 0)
        //        return true;
        //    else return viviLib.Text.Validate.IsIPSect(clientIp);
        //}
        /// <summary>
        ///
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void Page_Load(object sender, EventArgs e)
        {
            string error = string.Empty, apikey = "";
            bool   riskWarning = true;

            ////IP验证
            //if (!string.IsNullOrEmpty(this.clientIp))
            //{
            //    if (viviLib.Web.IPHelper.GetValue(this.clientIp) != viviLib.Web.IPHelper.GetValue(viviLib.Web.ServerVariables.TrueIP))
            //    {
            //        return;
            //    }
            //}

            #region Step1 必要的参数不能为空
            if (string.IsNullOrEmpty(this.userid))
            {
                error = "error:1001 商户ID(userid)不能空!";
            }
            else if (string.IsNullOrEmpty(bankid))
            {
                error = "error:1002 银行编号(bankid)不能空!";
            }
            else if (string.IsNullOrEmpty(money))
            {
                error = "error:1003 订单金额(money)不能空!";
            }
            else if (string.IsNullOrEmpty(orderid))
            {
                error = "error:1004 商户订单号(orderid)不能空!";
            }
            else if (string.IsNullOrEmpty(notifyurl))
            {
                error = "error:1005 商户接收后台返回储值结果的地址(url)不能空!";
            }

            /*else if (string.IsNullOrEmpty(version))
             * {
             *   error = "error:1006 版本号(version)不能空!";
             * }*/
            else if (string.IsNullOrEmpty(sign))
            {
                error = "error:1006 签名数据(sign)不能空!";
            }
            #endregion

            #region Step2 检查参数长度
            else if (userid.Length > 10)
            {
                error = "error:1020 商户ID(userid)长度超过5位!";
            }
            else if (bankid.Length > 5)
            {
                error = "error:1021 银行编号(bankid)长度超过4位!";
            }
            else if (orderid.Length > 30)
            {
                error = "error:1022 商户订单号(orderid)长度超过30位!";
            }
            else if (money.Length > 8)
            {
                error = "error:1023 订单金额(money)长度超过最长限制!";
            }
            else if (this.notifyurl.Length > 255)
            {
                error = "error:1024 商户接收后台返回储值结果的地址(url)长度超过255位!";
            }
            else if (this.returnurl.Length > 255)
            {
                error = "error:1025 下行同步通知地址(aurl)长度超过255位!";
            }
            //else if (this.clientIp.Length > 20)
            //{
            //    error = "error:1026 支付用户IP(payerIp)长度超过20位!";
            //}
            else if (this.attach.Length > 255)
            {
                error = "error:1027 备注消息(attach)长度超过255位!";
            }
            else if (this.sign.Length != 32)
            {
                error = "error:1028 签名(sign)长度不正确!";
            }
            #endregion

            #region Step3 格式验证
            else if (!viviLib.Text.Validate.IsNumeric(userid))
            {
                error = "error:1040 商户ID(userid)格式不正确!";
            }
            else if (!viviLib.Text.Validate.IsNumeric(bankid))
            {
                error = "error:1041 银行编号(bankid)格式不正确!";
            }
            //else if (!viviLib.Text.Validate.IsNumber(money) || !viviLib.Text.Validate.IsNumeric(money))//二位小数
            //{
            //    error = "error:1042 订单金额(money)格式不正确!";
            //}
            else if (!IsNotifyUrlOk())
            {
                error = "error:1043 商户接收后台返回储值结果的地址(url)格式不正确!";
            }
            else if (!IsReturnUrlOk())
            {
                error = "error:1044 下行同步通知地址(aurl)格式不正确!";
            }
            //else if (!isClientIpOk())
            //{
            //    error = "error:1045 支付用户IP(payerIp)格式不正确!";
            //}
            #endregion

            //完成基础资料的验证
            if (!string.IsNullOrEmpty(error))
            {
                WebUtility.ShowErrorMsg(error);
                return;
            }
            UserInfo userInfo = null;
            decimal  tranAmt  = decimal.Zero;
            int      userId   = int.Parse(userid);

            #region Step4 数据验证
            if (!decimal.TryParse(money, out tranAmt))
            {
                error = "error:1060 订单金额(money)有误!";
            }
            else if (tranAmt < this.MinTranAMT)
            {
                error = "error:1061 订单金额(money)小于最小允许交易额!";
            }
            else if (tranAmt > this.MaxChargeAMT)
            {
                error = string.Format("error:1062 订单金额(money){0:f2}大于最大允许交易额{1:f2}!", tranAmt, this.MaxChargeAMT);
            }
            else
            {
                var checkResult = Factory.Instance.CheckApiParms(userId, ChannelTypeId, RequiredCheckUserOrderNo, this.orderid);
                if (checkResult == null)
                {
                    error = "error:1063 系统错误";
                }
                else
                {
                    userInfo = checkResult.Obj as UserInfo;
                    if (userInfo == null)
                    {
                        error = "error:1067 系统错误";
                    }
                    else if (checkResult.ErrCode == 1)
                    {
                        error = "error:1064 商户编号不存在";
                    }
                    else if (checkResult.ErrCode == 2)
                    {
                        error = "error:1065 商户状态不正常";
                    }
                    else if (checkResult.ErrCode == 3)
                    {
                        error = "error:1069 商户订单号重复";
                    }
                    else if (!viviapi.SysInterface.Bank.Card70.BankReceiveVerify(sign, new object[] { userId, orderid.Trim(), bankid.Trim(), userInfo.APIKey }))
                    {
                        error = "error:1066 签名错误!";
                    }
                    else
                    {
                        apikey      = userInfo.APIKey;
                        riskWarning = userInfo.RiskWarning == 1 ? true : false;
                    }
                }
            }
            if (!string.IsNullOrEmpty(error))
            {
                WebUtility.ShowErrorMsg(error);
                return;
            }
            #endregion

            int         typeId = 0; int supplierId = 0;
            ChannelInfo channelInfo = viviapi.BLL.Channel.Channel.GetModel(sysBankcode, userId, true);

            if (channelInfo == null)
            {
                error = "error:1067:银行编号不存在!";
            }
            else if (channelInfo.isOpen.Value != 1)
            {
                error = "error:1068:通道维护中!";
            }
            if (!string.IsNullOrEmpty(error))
            {
                if (DebuglogOpen)
                {
                    if (userInfo != null && userInfo.isdebug == 1)
                    {
                        var debugInfo = new viviapi.Model.Sys.debuginfo
                        {
                            addtime   = DateTime.Now,
                            bugtype   = viviapi.Model.Sys.debugtypeenum.网银订单,
                            detail    = version,
                            errorcode = error,
                            errorinfo = error,
                            userid    = userInfo.ID,
                            url       = Request.RawUrl.ToString(CultureInfo.InvariantCulture)
                        };

                        viviapi.BLL.Sys.Debuglog.Insert(debugInfo);
                    }
                }

                WebUtility.ShowErrorMsg(error);
                return;
            }
            //else if (!UserFactory.CheckUserOrderId(userId, orderid))
            //{
            //    error = "error:1068:商户订单号重复!";
            //}
            typeId     = channelInfo.typeId;
            supplierId = channelInfo.supplier.Value;



            var order = new OrderBankInfo
            {
                orderid       = Factory.Instance.GenerateOrderId(OrderPrefix),
                addtime       = DateTime.Now,
                attach        = attach,
                notifycontext = string.Empty,
                notifycount   = 0,
                notifystat    = 0,
                notifyurl     = this.notifyurl,
                clientip      = ServerVariables.TrueIP,
                completetime  = DateTime.Now,
                returnurl     = returnurl,
                ordertype     = 1,
                typeId        = typeId,
                paymodeId     = this.sysBankcode,
                supplierId    = supplierId,
                supplierOrder = string.Empty,
                userid        = userId,
                userorder     = orderid,
                refervalue    = tranAmt,
                version       = version
            };
            //order.payRate = 0M;
            //order.supplierRate = chanelInfo.supprate;
            if (Request.UrlReferrer != null)
            {
                order.referUrl = Request.UrlReferrer.ToString();
            }
            else
            {
                order.referUrl = string.Empty;
            }
            order.server = RuntimeSetting.ServerId;

            if (userInfo != null)
            {
                order.manageId = userInfo.manageId;                   //业务
            }
            if (!order.manageId.HasValue || order.manageId.Value <= 0)
            {
                //if (AgentId > 0)
                //{
                //    if (viviapi.BLL.User.Factory.ChkAgent(AgentId))
                //    {
                //        order.agentId = AgentId;//代理
                //    }
                //}
                //else
                {
                    order.agentId = viviapi.BLL.User.Factory.GetPromID(userId);
                }
            }

            viviapi.Cache.WebCache.GetCacheService().AddObject(order.orderid, order, ExpiresTime);
            //
            newOrder.Insert(order);

            SellFactory.OnlineBankPay(order.userid, apikey, supplierId, order.orderid, order.refervalue, order.paymodeId, riskWarning);
        }