コード例 #1
0
ファイル: hf.aspx.cs プロジェクト: toyslife/PiaoBaoWork3.0
    protected void Page_Load(object sender, EventArgs e)
    {
        PbProject.Logic.Pay.ChinaPnr chinaPnr = new PbProject.Logic.Pay.ChinaPnr();
        string result = getParameter("txt");

        if (!string.IsNullOrEmpty(result))
        {
            string val = chinaPnr.Sign(result, result);
            Response.Write(val);
        }
        else
        {
            Response.Write("参数不能为空!");
        }
    }
コード例 #2
0
    /// <summary>
    /// 加载
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void Page_Load(object sender, EventArgs e)
    {
        string val = "";

        try
        {
            if (!IsPostBack)
            {
                if (Request.QueryString["user"] != null && Request.QueryString["oper"] != null)
                {
                    PbProject.Logic.Pay.ChinaPnr chinaPnr = new PbProject.Logic.Pay.ChinaPnr();
                    val = chinaPnr.Sign(Request.QueryString["user"].ToString().Trim(), Request.QueryString["oper"].ToString().Trim());
                }
            }
        }
        catch (Exception ex)
        {
        }
        val = !string.IsNullOrEmpty(val) ? val : "请求失败";
        Response.Write(val);
    }
コード例 #3
0
    /// <summary>
    /// 保存 充值收款账号
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void btnHFOK_Repay_Click(object sender, EventArgs e)
    {
        string msg = "";

        try
        {
            if (!string.IsNullOrEmpty(txtHF_Repay.Text.Trim()))
            {
                PbProject.Logic.Pay.ChinaPnr chinaPnr = new PbProject.Logic.Pay.ChinaPnr();
                if (chinaPnr.QuerySign(txtHF_Repay.Text.Trim(), txtHF_Repay.Text.Trim()))
                {
                    msg = BtnSave(2, 1, txtHF_Repay.Text.Trim());
                }
                else
                {
                    msg = "账号未签约!";
                }
            }
            else
            {
                msg = "请输入签约账号!";
            }
        }
        catch (Exception ex)
        {
            msg = "操作错误!";
        }

        if (msg.Contains("成功"))
        {
        }
        else
        {
            lbtnHFSign_Repay.Visible = true;
        }

        Page.ClientScript.RegisterStartupScript(this.GetType(), DateTime.Now.Ticks.ToString(), "showdialog('" + msg + "');", true);
    }
コード例 #4
0
    /// <summary>
    /// 退款处理
    /// </summary>
    /// <param name="payType">支付方式</param>
    /// <param name="oldOrderId">原支付订单号</param>
    /// <param name="newOrderId">退款订单号</param>
    /// <param name="onlineNo">在线交易号、退款流水号</param>
    /// <param name="price">订单金额</param>
    /// <param name="rate">手续费率</param>
    /// <param name="act">收款账号</param>
    /// <param name="detail">退款明细</param>
    /// <returns></returns>
    public string Refund(string payType, string oldOrderId, string newOrderId, string onlineNo, string price, string rate, string act, string detail)
    {
        string msg = "";

        try
        {
            string strOrderID       = newOrderId; //订单编号(退、废)
            string strOrderOldID    = oldOrderId; //原支付订单号
            string strOrderOnlineNo = onlineNo;   //交易号
            string strPrice         = price;      // 退款金额
            string strAct           = act;        //收款账号
            string details          = detail;     //退款明细


            decimal strRate = (!string.IsNullOrEmpty(rate)) ? decimal.Parse(rate) : 0.001M; //费率
            bool    result  = false;
            msg = (string.IsNullOrEmpty(strPrice)) ? "请输入退款金额!" : msg;
            msg = (string.IsNullOrEmpty(strAct)) ? "请输入收款账号!" : msg;
            decimal total = (!string.IsNullOrEmpty(strPrice)) ? decimal.Parse(strPrice) : 0; //订单退款金额
            total = total != 0 ? FourToFiveNum(total, 2) : total;

            if (payType == "1")
            {
                #region 支付宝
                msg = (string.IsNullOrEmpty(strOrderOnlineNo)) ? "请输入交易号!" : msg;
                msg = (strOrderOnlineNo.Length != 16) ? "交易号格式错误!" : msg;

                if (msg == "")
                {
                    PbProject.Logic.Pay.AliPay alipay = new PbProject.Logic.Pay.AliPay(false);

                    #region 处理
                    decimal priceRate = total * strRate; //费率
                    priceRate = FourToFiveNum(priceRate, 2);
                    decimal priceGy = total - priceRate; //供应退款
                    priceGy = FourToFiveNum(priceGy, 2);

                    if (string.IsNullOrEmpty(details))
                    {
                        details = strOrderOnlineNo + "^" + total.ToString("f2") + "^退款|" + act + "^^" + alipay._serveremail + "^^" + priceGy.ToString("f2") + "^退款";
                    }

                    if (strOrderOnlineNo != null && strOrderOnlineNo != "")
                    {
                        string bno = DateTime.Now.ToString("yyyyMMddHHmmsss");

                        string[] strValueS = new string[3];
                        strValueS[0] = bno;
                        strValueS[1] = "1";
                        strValueS[2] = details;

                        //退款
                        result = alipay.IsRefund(strValueS);

                        if (result == true)
                        {
                            msg = "数据提交成功,稍后请查询核对数据。。。";

                            #region 支付宝 查询退款

                            /*
                             * if (msg == "")
                             * {
                             *  string str = alipay.QueryRefundResultStr(strOrderOnlineNo);
                             *  string[] strs = str.Split('#');
                             *  for (int i = 0; i < strs.Length; i++)
                             *  {
                             *      if (!string.IsNullOrEmpty(strs[i]))
                             *      {
                             *          string[] strss = strs[i].Split('$');
                             *
                             *          if (!string.IsNullOrEmpty(strss[0]) && strss[0].Contains("SUCCESS"))
                             *          {
                             *              //退款成功
                             *              msg += "退款成功!银行卡 2 - 7个工作日到账,信用卡 2 - 14 个工作日到账!";
                             *              break;
                             *          }
                             *      }
                             *  }
                             * }
                             * */
                            #endregion
                        }
                        else
                        {
                            msg = "数据提交失败,请检测数据格式是否有误!!!";
                        }
                    }
                    #endregion
                }
                #endregion
            }
            else if (payType == "2")
            {
                #region 快钱
                msg = (string.IsNullOrEmpty(strOrderID)) ? "请输入订单号!" : msg;     //订单编号(退、废)
                msg = (string.IsNullOrEmpty(strOrderOldID)) ? "请输入原订单号!" : msg; //原支付订单号

                if (msg == "")
                {
                    #region 处理

                    PbProject.Logic.Pay._99Bill bill = new PbProject.Logic.Pay._99Bill(false);

                    string  dataTime  = DateTime.Now.ToString("yyyyMMddHHmmss");
                    decimal priceRate = total * strRate; //费率
                    priceRate = FourToFiveNum(priceRate, 2);
                    decimal priceGy = total - priceRate; //供应退款
                    priceGy = FourToFiveNum(priceGy, 2);

                    priceGy   = priceGy * 100;                              //供应退款
                    priceRate = priceRate * 100;                            //费率
                    total     = total * 100;                                //订单退款

                    int p1 = int.Parse(priceGy.ToString().Split('.')[0]);   //供应退款
                    int p2 = int.Parse(priceRate.ToString().Split('.')[0]); //费率
                    int p3 = int.Parse(total.ToString().Split('.')[0]);     //订单退款

                    //"1^[email protected]^5000^爱的|1^[email protected]^7000^分账1|1^[email protected]^8000^分账2";
                    if (string.IsNullOrEmpty(details))
                    {
                        details = "1^" + bill.LinkEmail + "^" + p2.ToString() + "^Refund|1^" + strAct + "^" + p1.ToString() + "^Refund";
                    }

                    string[] Details = new string[6];
                    Details[0] = strOrderOldID; // 订单编号(原订单号)
                    Details[1] = p3.ToString(); // 订单金额
                    Details[2] = "系统退款";        //备注
                    Details[3] = details;
                    Details[4] = strOrderID;    // 订单编号(退废订单编号)
                    Details[5] = dataTime;      //退款流水号


                    string str = bill.Refund(Details);

                    result = bill.IsRefund(str);
                    //result = true;

                    if (result == true)
                    {
                        msg = "数据提交成功,稍后请查询核对数据。。。";
                    }
                    else
                    {
                        msg = "数据提交失败,请检测数据格式是否有误!!!";
                    }

                    #endregion
                }
                #endregion
            }
            else if (payType == "3")
            {
                #region 汇付

                msg = (string.IsNullOrEmpty(strOrderID)) ? "请输入订单号!" : "";     //订单编号(退、废)
                msg = (string.IsNullOrEmpty(strOrderOldID)) ? "请输入原订单号!" : ""; //原支付订单号

                if (msg == "")
                {
                    #region 处理

                    PbProject.Logic.Pay.ChinaPnr chinaPnr = new PbProject.Logic.Pay.ChinaPnr(false);

                    string orderno = DateTime.Now.ToString("yyyyMMddHHmm");
                    string orderid = (strOrderID == strOrderOldID) ? orderno + "_" + strOrderOldID : strOrderID; //订单编号

                    decimal priceRate = total * strRate;                                                         //费率
                    priceRate = FourToFiveNum(priceRate, 2);
                    decimal priceGy = total - priceRate;                                                         //供应退款
                    priceGy = FourToFiveNum(priceGy, 2);

                    if (string.IsNullOrEmpty(details))
                    {
                        details = "Agent:" + act + ":" + priceGy.ToString("f2");
                    }

                    string[] Details = new string[4];
                    Details[0] = orderid;
                    Details[1] = strOrderOldID;
                    Details[2] = strPrice;
                    Details[3] = details;

                    string value = chinaPnr.Refund(Details[0], Details[1], Details[2], Details[3]);

                    if (value.Contains("RespCode=000000") && value.Contains("ErrMsg=成功"))
                    {
                        msg = "数据提交成功,稍后请查询核对数据。。。";
                    }
                    else
                    {
                        msg = "数据提交失败,请检测数据格式是否有误!!!";
                    }
                    #endregion
                }
                #endregion
            }
            else if (payType == "4")
            {
                #region 财付通


                #endregion
            }
            else
            {
                msg = "请选择支付方式";
            }
        }
        catch (Exception)
        {
        }

        return(msg);
    }
コード例 #5
0
    /// <summary>
    /// IsValidation
    /// </summary>
    private void IsValidation()
    {
        try
        {
            //GateId =U2
            //MerPriv =
            //TrxId =2013062589057816
            //OrdId =30201020130625000010
            //RetType =2
            //OrdAmt =1.00
            //Pid =
            //ChkValue =9188B176EE0CEC769E077BC63ACE7ADBDAD0FA273A5C81DF9E14C67789F93FACFBF062F22A9EECCA4208CBCEDC4084505C4565E32BA20C9670FC83C775804520AC8C317A2B59BF1FE173F7AC58A80286A54DBA3A2B6C8CFC8559A8530D6E2A55CDF1286A6EE1169712C90212526EA8A0E954B0D3488A8BEEC025DB4AA702F6BD
            //CmdId =Buy
            //DivDetails =Agent:00000458605930201020:1.00
            //CurCode =RMB
            //RespCode =000000
            //MerId =871997

            String GateId, MerPriv, TrxId, OrdId, RetType, OrdAmt, Pid, ChkValue, CmdId, DivDetails, CurCode, RespCode, MerId;

            GateId     = Request.Form["GateId"];
            MerPriv    = Request.Form["MerPriv"];
            TrxId      = Request.Form["TrxId"];
            OrdId      = Request.Form["OrdId"];
            RetType    = Request.Form["RetType"];
            OrdAmt     = Request.Form["OrdAmt"];
            Pid        = Request.Form["Pid"];
            ChkValue   = Request.Form["ChkValue"];
            CmdId      = Request.Form["CmdId"];
            DivDetails = Request.Form["DivDetails"];
            CurCode    = Request.Form["CurCode"];
            RespCode   = Request.Form["RespCode"];
            MerId      = Request.Form["MerId"];



            string SignData = "";

            #region 验证签名使用

            PbProject.Logic.Pay.ChinaPnr _ChinaPnr = new PbProject.Logic.Pay.ChinaPnr();
            String MsgData;
            MsgData = CmdId + MerId + RespCode + TrxId + OrdAmt + CurCode + Pid + OrdId + MerPriv + RetType + DivDetails + GateId; //参数顺序不能错
            CHINAPNRLib.NetpayClient SignObject = new CHINAPNRLib.NetpayClientClass();
            SignData = SignObject.VeriSignMsg0(_ChinaPnr._PgKeyUrl, MsgData, MsgData.Length, ChkValue);                            //请将此处改成你的私钥文件所在路径

            #endregion


            if (SignData == "0")
            {
                if (RespCode == "000000")
                {
                    #region 交易成功

                    if (CmdId == "Buy")
                    {
                        new PbProject.Logic.Pay.Bill().CreateLogMoneyDetail("", TrxId, OrdAmt, 12, OrdId.Substring(0, 8), "POS充值", "POS充值");
                    }
                    #endregion
                }
                else
                {
                    //交易失败
                    OnErrorNew("交易失败 OrdId=" + OrdId, false);
                }
                Response.Write("RECV_ORD_ID_" + OrdId);
            }
            else
            {
                //验签失败
                OnErrorNew("验签失败", false);
            }
        }
        catch (Exception ex)
        {
        }
    }
コード例 #6
0
    /// <summary>
    /// Validation
    /// </summary>
    private string Validation()
    {
        string val = "";

        try
        {
            String CmdId, MerId, RespCode, TrxId, OrdAmt, CurCode, Pid, OrdId, MerPriv, RetType, DivDetails, GateId, ChkValue;

            CmdId      = Request.Form["CmdId"];         //消息类型
            MerId      = Request.Form["MerId"];         //商户号
            RespCode   = Request.Form["RespCode"];      //应答返回码
            TrxId      = Request.Form["TrxId"];         //钱管家交易唯一标识
            OrdAmt     = Request.Form["OrdAmt"];        //金额
            CurCode    = Request.Form["CurCode"];       //币种
            Pid        = Request.Form["Pid"];           //商品编号
            OrdId      = Request.Form["OrdId"];         //订单号
            MerPriv    = Request.Form["MerPriv"];       //商户私有域
            RetType    = Request.Form["RetType"];       //返回类型
            DivDetails = Request.Form["DivDetails"];    //分账明细
            GateId     = Request.Form["GateId"];        //银行ID
            ChkValue   = Request.Form["ChkValue"];      //签名信息

            PbProject.Logic.Pay.ChinaPnr _ChinaPnr = new PbProject.Logic.Pay.ChinaPnr();

            //验证签名
            String MsgData, SignData;
            MsgData = CmdId + MerId + RespCode + TrxId + OrdAmt + CurCode + Pid + OrdId + MerPriv + RetType + DivDetails + GateId;
            CHINAPNRLib.NetpayClient SignObject = new CHINAPNRLib.NetpayClientClass();

            SignData = SignObject.VeriSignMsg0(_ChinaPnr._PgKeyUrl, MsgData, MsgData.Length, ChkValue);       //请将此处改成你的私钥文件所在路径

            if (SignData == "0")
            {
                if (RespCode == "000000")
                {
                    #region 交易成功

                    if (CmdId == "Buy")
                    {
                        #region 支付
                        #endregion
                    }
                    else if (CmdId == "Refund")
                    {
                        #region 退款
                        #endregion
                    }

                    #endregion

                    val = "Sucess.aspx?PayType=3&ReturnType=1&OrderId=" + OrdId + "&Price=" + OrdAmt + "&OnLineNo=" + OrdId;
                }
                else
                {
                    //交易失败
                    OnErrorNew("交易失败", false);
                }
            }
            else
            {
                OnErrorNew("验证失败", false);
            }
        }
        catch (Exception ex)
        {
            OnErrorNew("catch:" + ex, false);
        }

        return(val);
    }
コード例 #7
0
    /// <summary>
    /// IsValidation
    /// </summary>
    private void IsValidation()
    {
        try
        {
            String CmdId, MerId, RespCode, TrxId, OrdAmt, CurCode, Pid, OrdId, MerPriv, RetType, DivDetails, GateId, ChkValue;
            String MsgData = "", SignData = "";

            CmdId      = Request.Form["CmdId"];         //消息类型
            MerId      = Request.Form["MerId"];         //商户号
            RespCode   = Request.Form["RespCode"];      //应答返回码
            TrxId      = Request.Form["TrxId"];         //钱管家交易唯一标识
            OrdAmt     = Request.Form["OrdAmt"];        //金额
            CurCode    = Request.Form["CurCode"];       //币种
            Pid        = Request.Form["Pid"];           //商品编号
            OrdId      = Request.Form["OrdId"];         //订单号
            MerPriv    = Request.Form["MerPriv"];       //商户私有域
            RetType    = Request.Form["RetType"];       //返回类型
            DivDetails = Request.Form["DivDetails"];    //分账明细
            GateId     = Request.Form["GateId"];        //银行ID
            ChkValue   = Request.Form["ChkValue"];      //签名信息

            PbProject.Logic.Pay.ChinaPnr _ChinaPnr = new PbProject.Logic.Pay.ChinaPnr();

            #region 旧方法

            /*
             *
             * String MsgData, SignData;
             * MsgData = CmdId + MerId + RespCode + TrxId + OrdAmt + CurCode + Pid + OrdId + MerPriv + RetType + DivDetails + GateId;   //参数顺序不能错
             * CHINAPNRLib.NetpayClient SignObject = new CHINAPNRLib.NetpayClientClass();
             * SignData = SignObject.VeriSignMsg0(_ChinaPnr._PgKeyUrl, MsgData, MsgData.Length, ChkValue);           //请将此处改成你的私钥文件所在路径
             *
             */

            #endregion


            if (SignData == "0")
            {
                if (RespCode == "000000")
                {
                    #region 交易成功

                    if (CmdId == "Buy")
                    {
                        //支付
                        if (OrdId.Substring(0, 1) == "0")
                        {
                        }
                    }
                    #endregion
                }
                else
                {
                    //交易失败
                    OnErrorNew("交易失败", false);
                }
                Response.Write("RECV_ORD_ID_" + OrdId);
            }
            else
            {
                //验签失败
                OnErrorNew("验签失败", false);
            }
        }
        catch (Exception ex)
        {
        }
    }
コード例 #8
0
    /// <summary>
    /// 在线充值
    /// </summary>
    /// <param name="id">订单id</param>
    /// <param name="payWay">支付方式</param>
    /// <param name="code">网银银行代码</param>
    /// <param name="price">充值金额</param>
    private void OnlineRepaymentOrderPay(string id, string payWay, string code, string price)
    {
        string strFromValue = "";
        var    url          = string.Empty;

        try
        {
            PbProject.Logic.Pay.DataAction data         = new PbProject.Logic.Pay.DataAction();
            Tb_Ticket_OrderBLL             ticket_Order = new Tb_Ticket_OrderBLL();
            //string indexId = ticket_Order.GetIndexId();//内部流水号
            string orderId = ticket_Order.GetOrderId("1");//订单编号
            //string payCpyNo = mCompany.UninCode; //付款公司编号

            string payId = mUser != null?mUser.id.ToString() : ""; //付款公司编号

            string act = UseAct(payWay, mUser.CpyNo);              //收款账号

            if (!string.IsNullOrEmpty(payId) && !string.IsNullOrEmpty(act))
            {
                //添加交易日志
                //bool reuslt = new PbProject.Logic.Pay.Bill().InsertLogMoneyDetail(orderId, indexId, price, payWay, mUser, mCompany);

                if (payWay == "1" || payWay == "5")//支付宝
                {
                    #region 支付宝

                    #region 参数赋值

                    decimal total      = decimal.Parse(price);                      //订单支付金额
                    decimal supperates = 0.001M;                                    //支付费率
                    decimal paySXF     = data.FourToFiveNum(total * supperates, 2); //支付手续费
                    decimal actPrice   = total - paySXF;                            //收款账号金额
                    string  detail     = act + "^" + actPrice.ToString("F2") + "^充值收款";
                    #endregion

                    AliPayParam aliPayParam = new AliPayParam();
                    aliPayParam.Out_trade_no       = orderId;          //内部订单号
                    aliPayParam.Subject            = "在线充值";           //商品名称
                    aliPayParam.Body               = "在线充值";           //商品描述
                    aliPayParam.Total_fee          = total.ToString(); //订单总价
                    aliPayParam.Royalty_parameters = detail;           //分润参数
                    aliPayParam.Extend_param       = "";               //公用业务扩展参数,支付宝用于 显示 PNR (格式:参数名1^参数值1|参数名2^参数值2|......)
                    aliPayParam.Extra_common_param = payId;            //自定义字段
                    aliPayParam.DefaultBank        = code;             //网银标示

                    strFromValue = new PbProject.Logic.Pay.AliPay().GetPay(aliPayParam);
                    #endregion
                }
                else if (payWay == "2" || payWay == "6")//快钱
                {
                    #region 快钱

                    #region 参数赋值
                    decimal total      = decimal.Parse(price);                      //订单支付金额
                    decimal supperates = 0.001M;                                    //支付费率
                    decimal paySXF     = data.FourToFiveNum(total * supperates, 2); //支付手续费
                    decimal actPrice   = total - paySXF;                            //收款账号金额

                    int totalInt    = int.Parse((total * 100).ToString().Split('.')[0]);
                    int paySXFInt   = int.Parse((paySXF * 100).ToString().Split('.')[0]);
                    int actPriceInt = int.Parse((actPrice * 100).ToString().Split('.')[0]);

                    string detail = "1^" + act + "^" + actPriceInt.ToString() + "^0^充值收款";
                    #endregion

                    _99BillParam billParam = new _99BillParam();
                    billParam.Orderid  = orderId;                                    //0.订单编号
                    billParam.Price    = totalInt.ToString();                        //1.订单金额,单位“分”
                    billParam.Money    = paySXFInt.ToString();;                      //2.手续费,单位“分”
                    billParam.Pname    = "在线充值";                                     //3.商品名称
                    billParam.Ext      = payId;                                      //4.自定义字段
                    billParam.Detail   = detail;                                     //5.分润数据集
                    billParam.Ptype    = "1";                                        //6.分润类别,1 立刻分润 0 异步分润
                    billParam.Payid    = "*****@*****.**";;                       //7.付款帐户
                    billParam.Paytype  = (string.IsNullOrEmpty(code)) ? "00" : "10"; //8.  00:组合支付,10:银行卡支付
                    billParam.Bankcode = code;                                       //9: 银行代码
                    strFromValue       = new PbProject.Logic.Pay._99Bill().GetPay(billParam);
                    #endregion
                }
                else if (payWay == "3" || payWay == "7")//汇付天下
                {
                    #region 汇付天下

                    #region 参数赋值
                    decimal total      = decimal.Parse(price);                      //订单支付金额
                    decimal supperates = 0.001M;                                    //支付费率
                    decimal paySXF     = data.FourToFiveNum(total * supperates, 2); //支付手续费
                    decimal actPrice   = total - paySXF;                            //收款账号金额
                    string  detail     = "Agent:" + act + ":" + actPrice;
                    #endregion

                    ChinaPnrParam chinaPnrParam = new ChinaPnrParam();
                    chinaPnrParam.Orderid = orderId;              //订单号
                    chinaPnrParam.Price   = total.ToString("f2"); //订单总价
                    chinaPnrParam.Merpriv = payId;                //自定义字段
                    chinaPnrParam.Details = detail;
                    strFromValue          = new PbProject.Logic.Pay.ChinaPnr().Buy(chinaPnrParam);

                    #endregion
                }
                else if (payWay == "4" || payWay == "8" || payWay == "40")// 财付通
                {
                    #region 财付通

                    #region 参数赋值

                    string  actXSF     = UseAct(payWay, mUser.CpyNo.Substring(0, 12)); //手续费收款账号
                    decimal total      = decimal.Parse(price);                         //订单支付金额
                    decimal supperates = 0.001M;                                       //支付费率
                    decimal paySXF     = data.FourToFiveNum(total * supperates, 2);    //支付手续费
                    decimal actPrice   = total - paySXF;                               //收款账号金额

                    total = total * 100;

                    //TenPayParam tenPayParam = new TenPayParam();
                    //tenPayParam.Bus_Args = string.Format("{0}^{1}^1|{2}^{3}^2", act, actPrice, actXSF, paySXF);
                    ////tenPayParam.Bus_Desc = "12345^深圳-上海^1^fady^庄^13800138000";///业务描述,特定格式的字符串,格式为:PNR^航程^机票张数^机票销售商在机票平台的id^联系人姓名^联系电话
                    //tenPayParam.Bus_Desc = "机票充值";
                    //tenPayParam.Desc = "在线充值";
                    //tenPayParam.Orderid = orderId;
                    //tenPayParam.Total_Tee = total.ToString("F0");
                    //tenPayParam.UserHostAddress = Page.Request.UserHostAddress;

                    string queryParam = string.Format("orderid={0}&total_tee={1}&userhostaddress={2}&attach={3}&busargs={4}&busdesc={5}&banktype={6}",
                                                      orderId, total.ToString("F0"), Request.UserHostAddress, mUser.id.ToString(), string.Format("{0}^{1}^1|{2}^{3}^2", act, (actPrice * 100).ToString("F0"), actXSF, (paySXF * 100).ToString("F0")), "在线充值", code);//,string.Format("{0}^{1}^{2}^{3}^{4}^{5}", mOrder.PNR, mOrder.Travel, mOrder.PassengerNumber, mUser.id.ToString(), mOrder.CreateUserName, "13800000000"));
                    url = string.Format("http://lzh.mypb.cn/Pay/TenPay.aspx?{0}", queryParam);

                    //strFromValue = new PbProject.Logic.Pay.TenPay().SplitPayRequest(tenPayParam);

                    #endregion

                    #endregion
                }
            }
            else
            {
                strFromValue = "收款方账号错误!";
            }
        }
        catch (Exception)
        {
            strFromValue = "收款方账号异常!";
        }

        if (!string.IsNullOrEmpty(url))
        {
            Response.Redirect(url);
        }
        if (!string.IsNullOrEmpty(strFromValue))
        {
            OnErrorNew(strFromValue, false);
        }
        Response.Write(strFromValue);
    }
コード例 #9
0
    /// <summary>
    /// 短信支付
    /// </summary>
    /// <param name="id">订单id</param>
    /// <param name="payWay">支付方式</param>
    /// <param name="code">网银银行代码</param>
    private void SmsOrderPay(string id, string payWay, string code, string prices)
    {
        string url          = string.Empty;
        string strFromValue = "";

        PbProject.Logic.Pay.DataAction data         = new PbProject.Logic.Pay.DataAction();
        Tb_Ticket_OrderBLL             ticket_Order = new Tb_Ticket_OrderBLL();

        string orderId = id;     //订单编号
        string price   = prices; //订单金额

        //string payCpyNo = mCompany.UninCode; //付款公司编号
        string payId = mUser != null?mUser.id.ToString() : ""; //付款公司编号

        string act = UseAct(payWay, mUser.CpyNo);              //收款账号

        try
        {
            //PayWay 支付方式:1支付宝、2快钱、3汇付、4财付通、5支付宝网银、6快钱网银 、7汇付网银、8财付通网银、
            //9支付宝pos、10快钱pos、11汇付pos、12财付通pos、13易宝pos、14账户支付、15收银
            if (payWay == "1" || payWay == "5")//支付宝
            {
                #region 支付宝

                #region 参数赋值

                decimal total      = decimal.Parse(price);                      //订单支付金额
                decimal supperates = 0.001M;                                    //支付费率
                decimal paySXF     = data.FourToFiveNum(total * supperates, 2); //支付手续费
                decimal actPrice   = total - paySXF;                            //收款账号金额
                string  detail     = act + "^" + actPrice.ToString("F2") + "^充值收款";
                #endregion

                AliPayParam aliPayParam = new AliPayParam();
                aliPayParam.Out_trade_no       = orderId;          //内部订单号
                aliPayParam.Subject            = "在线充值";           //商品名称
                aliPayParam.Body               = "在线充值";           //商品描述
                aliPayParam.Total_fee          = total.ToString(); //订单总价
                aliPayParam.Royalty_parameters = detail;           //分润参数
                aliPayParam.Extend_param       = "";               //公用业务扩展参数,支付宝用于 显示 PNR (格式:参数名1^参数值1|参数名2^参数值2|......)
                aliPayParam.Extra_common_param = payId;            //自定义字段
                aliPayParam.DefaultBank        = code;             //网银标示

                strFromValue = new PbProject.Logic.Pay.AliPay().GetPay(aliPayParam);
                #endregion
            }
            else if (payWay == "2" || payWay == "6")//快钱
            {
                #region 快钱

                #region 参数赋值
                decimal total      = decimal.Parse(price);                      //订单支付金额
                decimal supperates = 0.001M;                                    //支付费率
                decimal paySXF     = data.FourToFiveNum(total * supperates, 2); //支付手续费
                decimal actPrice   = total - paySXF;                            //收款账号金额

                int totalInt    = int.Parse((total * 100).ToString().Split('.')[0]);
                int paySXFInt   = int.Parse((paySXF * 100).ToString().Split('.')[0]);
                int actPriceInt = int.Parse((actPrice * 100).ToString().Split('.')[0]);

                string detail = "1^" + act + "^" + actPriceInt.ToString() + "^0^充值收款";
                #endregion

                _99BillParam billParam = new _99BillParam();
                billParam.Orderid  = orderId;                                    //0.订单编号
                billParam.Price    = totalInt.ToString();                        //1.订单金额,单位“分”
                billParam.Money    = paySXFInt.ToString();;                      //2.手续费,单位“分”
                billParam.Pname    = "在线充值";                                     //3.商品名称
                billParam.Ext      = payId;                                      //4.自定义字段
                billParam.Detail   = detail;                                     //5.分润数据集
                billParam.Ptype    = "1";                                        //6.分润类别,1 立刻分润 0 异步分润
                billParam.Payid    = "*****@*****.**";;                       //7.付款帐户
                billParam.Paytype  = (string.IsNullOrEmpty(code)) ? "00" : "10"; //8.  00:组合支付,10:银行卡支付
                billParam.Bankcode = code;                                       //9: 银行代码
                strFromValue       = new PbProject.Logic.Pay._99Bill().GetPay(billParam);
                #endregion
            }
            else if (payWay == "3" || payWay == "7")//汇付天下
            {
                #region 汇付天下

                #region 参数赋值
                decimal total      = decimal.Parse(price);                      //订单支付金额
                decimal supperates = 0.001M;                                    //支付费率
                decimal paySXF     = data.FourToFiveNum(total * supperates, 2); //支付手续费
                decimal actPrice   = total - paySXF;                            //收款账号金额
                string  detail     = "Agent:" + act + ":" + actPrice;
                #endregion

                ChinaPnrParam chinaPnrParam = new ChinaPnrParam();
                chinaPnrParam.Orderid = orderId;              //订单号
                chinaPnrParam.Price   = total.ToString("f2"); //订单总价
                chinaPnrParam.Merpriv = payId;                //自定义字段
                chinaPnrParam.Details = detail;
                strFromValue          = new PbProject.Logic.Pay.ChinaPnr().Buy(chinaPnrParam);

                #endregion
            }
            else if (payWay == "4" || payWay == "8")// 财付通
            {
                #region 财付通

                #region 参数赋值
                string  actXSF     = UseAct(payWay, mUser.CpyNo.Substring(0, 12)); //手续费收款账号
                decimal total      = decimal.Parse(price);                         //订单支付金额
                decimal supperates = 0.001M;                                       //支付费率
                decimal paySXF     = data.FourToFiveNum(total * supperates, 2);    //支付手续费
                decimal actPrice   = total - paySXF;                               //收款账号金额
                total = total * 100;
                string busdesc = string.Empty;
                if (paySXF > 0)
                {
                    busdesc = string.Format("{0}^{1}^1|{2}^{3}^2", act, (actPrice * 100).ToString("F0"), actXSF, (paySXF * 100).ToString("F0"));
                }
                else
                {
                    busdesc = string.Format("{0}^{1}^1", act, (actPrice * 100).ToString("F0"));
                }
                //TenPayParam tenPayParam = new TenPayParam();
                //tenPayParam.Bus_Args = act + "^" + actPrice + "^1|";
                //// tenPayParam.Bus_Desc = "12345^深圳-上海^1^fady^庄^13800138000";///业务描述,特定格式的字符串,格式为:PNR^航程^机票张数^机票销售商在机票平台的id^联系人姓名^联系电话
                //tenPayParam.Bus_Desc = "测试";
                //tenPayParam.Desc = "在线充值";
                //tenPayParam.Orderid = orderId;
                //tenPayParam.Total_Tee = total.ToString("F0");
                //tenPayParam.UserHostAddress = Page.Request.UserHostAddress;

                //strFromValue = new PbProject.Logic.Pay.TenPay().SplitPayRequest(tenPayParam);

                string queryParam = string.Format("orderid={0}&total_tee={1}&userhostaddress={2}&attach={3}&busargs={4}&busdesc={5}",
                                                  orderId, total.ToString("F0"), Request.UserHostAddress, mUser.id.ToString(), busdesc, "短信支付");//,string.Format("{0}^{1}^{2}^{3}^{4}^{5}", mOrder.PNR, mOrder.Travel, mOrder.PassengerNumber, mUser.id.ToString(), mOrder.CreateUserName, "13800000000"));
                url = string.Format("http://lzh.mypb.cn/Pay/TenPay.aspx?{0}", queryParam);

                #endregion

                #endregion
            }
            else if (payWay == "14")//账户余额
            {
                #region 账户余额
                if (mCompany != null)
                {
                    List <User_Company> listSmsUser     = baseDataManage.CallMethod("User_Company", "GetList", null, new Object[] { "UninCode='" + mCompany.UninCode + "'" }) as List <User_Company>;
                    decimal             maxMoney        = listSmsUser[0].MaxDebtMoney;                        //最大欠款额度
                    decimal             oldAccountMoney = listSmsUser[0].AccountMoney;                        // 支付前
                    decimal             newAccountMoney = oldAccountMoney + maxMoney - decimal.Parse(prices); // 支付后

                    if (newAccountMoney >= 0)
                    {
                        PbProject.Logic.Pay.Bill bill = new PbProject.Logic.Pay.Bill();
                        strFromValue = bill.MakeSMS(id, "", 14) == true ? "充值成功" : "充值失败";
                    }
                    else
                    {
                        strFromValue = "账户余额不足";
                    }
                }
                #endregion
            }
        }
        catch (Exception)
        {
            strFromValue = "支付异常";
        }

        if (!string.IsNullOrEmpty(url))
        {
            Response.Redirect(url);
        }
        if (!string.IsNullOrEmpty(strFromValue))
        {
            OnErrorNew(strFromValue, false);
        }

        Response.Write(strFromValue);
    }
コード例 #10
0
    /// <summary>
    /// 机票支付
    /// </summary>
    /// <param name="id">订单</param>
    /// <param name="payWay">支付方式</param>
    /// <param name="code">网银银行代码</param>
    private void TicketOrderPay(string id, string payWay, string code)
    {
        string msgShow = "";
        string url     = string.Empty;

        try
        {
            bool   result     = false;
            string payDetails = "";//分账明细

            #region 获取订单信息

            //PayWay 支付方式:1支付宝、2快钱、3汇付、4财付通、5支付宝网银、6快钱网银 、7汇付网银、8财付通网银、
            //9支付宝pos、10快钱pos、11汇付pos、12财付通pos、13易宝pos、14账户支付、15收银
            //string tempSqlWhere = " OrderId='" + id + "'";

            string tempSqlWhere = " id='" + id + "'";
            List <Tb_Ticket_Order> bParametersList = new PbProject.Logic.Order.Tb_Ticket_OrderBLL().GetListBySqlWhere(tempSqlWhere);
            Tb_Ticket_Order        mOrder          = null;

            if (bParametersList != null && bParametersList.Count == 1)
            {
                mOrder = bParametersList[0];

                #region 判断PNR状态是否取消等,取消就不能支付
                if (mOrder.OrderStatusCode != 1 && mOrder.OrderStatusCode != 9)
                {
                    msgShow = "订单异常,不能支付!";
                }
                #endregion

                if (this.KongZhiXiTong.Contains("|101|"))
                {
                    //超过 1 小时后的订单能支付
                }
                else
                {
                    #region  超过1个小时不能支付
                    if (mOrder.OrderStatusCode == 1)
                    {
                        DateTime dtTime = DateTime.Now;
                        if (dtTime.CompareTo(mOrder.CreateTime.AddHours(1)) > 0)
                        {
                            // 超过1个小时不能支付
                            msgShow = "超过1个小时的订单不能支付,请重新生成订单进行支付!";
                        }
                    }
                    #endregion
                }

                #region 判断PNR状态是否取消等,取消就不能支付

                //扩展参数
                ParamEx pe = new ParamEx();
                pe.UsePIDChannel = this.KongZhiXiTong != null && this.KongZhiXiTong.Contains("|48|") ? 2 : 0;
                SendInsManage sendins = new SendInsManage(mUser.LoginName, mCompany.UninCode, pe, this.configparam);
                string        ErrMsg;

                if (mOrder.OrderSourceType == 1 && mOrder.A9 != "1")
                {
                    PnrAnalysis.PnrModel PnrModel = sendins.GetPnr(mOrder.PNR, mOrder.Office, out ErrMsg);

                    if (ErrMsg.IndexOf("已被取消") != -1)
                    {
                        msgShow = "此PNR(" + mOrder.PNR + ")状态为异常,请检查PNR状态后再试!";
                    }
                    else if (PnrModel != null && ErrMsg == "")
                    {
                        if (PnrModel.PassengerNameIsCorrent)
                        {
                            if (KongZhiXiTong != null && KongZhiXiTong.Contains("|23|"))
                            {
                                if ((PnrModel._OldPnrContent.Contains("THIS PNR WAS ENTIRELY CANCELLED") && PnrModel._OldPnrContent.ToUpper().Contains(mOrder.PNR.ToUpper())))
                                {
                                    msgShow = "此PNR(" + mOrder.PNR + ")状态为异常,请检查PNR状态后再试!";
                                }
                                else
                                {
                                    string PnrStatus = PnrModel.PnrStatus;
                                    if (string.IsNullOrEmpty(PnrStatus))
                                    {
                                        msgShow = "此PNR(" + mOrder.PNR + ")数据异常,请检查PNR状态后再试!";
                                    }
                                    else
                                    {
                                        if (!PnrStatus.Contains("HK") && !PnrStatus.Contains("DK") && !PnrStatus.Contains("RR") && !PnrStatus.Contains("KK"))
                                        {
                                            msgShow = "此PNR(" + mOrder.PNR + ")状态为:" + PnrStatus + ",请检查PNR状态后再试!";
                                        }
                                    }
                                }
                            }
                        }
                        else
                        {
                            msgShow = "此PNR(" + mOrder.PNR + ")中乘机人名字:" + string.Join(",", PnrModel.ErrorPassengerNameList.ToArray()) + " 不正确!";
                        }
                    }
                }

                #endregion 判断PNR状态是否取消等,取消就不能支付

                if (msgShow == "")
                {
                    mOrder.PayWay = int.Parse(payWay);

                    // 切换支付方式:修改订单账单明细数据
                    result = new PbProject.Logic.Pay.Bill().UpdateOrderAndTicketPayDetail(mOrder);

                    if (result == true)
                    {
                        //获取分账明细
                        payDetails = new PbProject.Logic.Pay.Bill().PayDetails(payWay, mOrder.OrderId);
                        result     = string.IsNullOrEmpty(payDetails) ? false : result;
                    }
                }
            }

            #endregion

            if (result)
            {
                #region 支付

                if (payWay == "1" || payWay == "5")//支付宝
                {
                    #region 支付参数赋值

                    AliPayParam aliPayParam = new AliPayParam();

                    aliPayParam.Body               = "机票订单";
                    aliPayParam.DefaultBank        = code;
                    aliPayParam.Extra_common_param = mUser.id.ToString(); //自定义:操作人id
                    aliPayParam.Out_trade_no       = mOrder.OrderId;
                    aliPayParam.Royalty_parameters = payDetails;          //分账明细
                    aliPayParam.Subject            = "机票订单";
                    aliPayParam.Total_fee          = mOrder.PayMoney.ToString("f2");


                    if ((!string.IsNullOrEmpty(mOrder.A9) && mOrder.A9 == "1") || string.IsNullOrEmpty(mOrder.PNR))
                    {
                        //不检查编码

                        OnErrorNew("不检查编码,PNR:" + mOrder.PNR, false);
                    }
                    else
                    {
                        //需要检查编码
                        #region 判断PNR

                        tempSqlWhere = " PNR='" + mOrder.PNR + "' and OrderStatusCode=4 and (PayWay=1 or PayWay=5)";
                        List <Tb_Ticket_Order> orderListNew = new PbProject.Logic.Order.Tb_Ticket_OrderBLL().GetListBySqlWhere(tempSqlWhere);

                        if (orderListNew == null || orderListNew.Count == 0)
                        {
                            //先看该订单支付已经支付过
                            aliPayParam.Extend_param = "PNR^" + mOrder.PNR;
                        }
                        else
                        {
                            OnErrorNew("该编码已经有支付记录,PNR:" + mOrder.PNR, false);
                        }

                        #endregion
                    }

                    #endregion

                    msgShow = new PbProject.Logic.Pay.AliPay().GetPay(aliPayParam);
                }
                else if (payWay == "2" || payWay == "6")//快钱
                {
                    PbProject.Logic.Pay.DataAction d = new PbProject.Logic.Pay.DataAction();
                    decimal tempMoney = d.FourToFiveNum(mOrder.PayMoney * 0.001M, 2) * 100; //手续费

                    #region 支付参数赋值
                    _99BillParam billParam = new _99BillParam();
                    billParam.Bankcode = code;
                    billParam.Detail   = payDetails;               //分账明细
                    billParam.Ext      = mUser.id.ToString();      //操作人id
                    billParam.Money    = tempMoney.ToString("f0"); //供应商收款
                    billParam.Orderid  = mOrder.OrderId;
                    //billParam.Payid = "*****@*****.**";
                    billParam.Payid   = "";
                    billParam.Paytype = (string.IsNullOrEmpty(code)) ? "00" : "10";
                    billParam.Pname   = "机票订单";
                    billParam.Price   = (mOrder.PayMoney * 100).ToString("f0"); //供应商收款
                    billParam.Ptype   = "1";

                    #endregion

                    msgShow = new PbProject.Logic.Pay._99Bill().GetPay(billParam);
                }
                else if (payWay == "3" || payWay == "7")//汇付天下
                {
                    #region 支付参数赋值

                    ChinaPnrParam chinaPnrParam = new ChinaPnrParam();
                    chinaPnrParam.Orderid = mOrder.OrderId;                 //订单号
                    chinaPnrParam.Price   = mOrder.PayMoney.ToString("f2"); //订单总价
                    chinaPnrParam.Merpriv = mUser.id.ToString();            //自定义字段
                    chinaPnrParam.Details = payDetails;                     //分账明细
                    chinaPnrParam.Pnr     = mOrder.PNR;

                    #endregion

                    msgShow = new PbProject.Logic.Pay.ChinaPnr().Buy(chinaPnrParam);
                }
                else if (payWay == "4" || payWay == "8" || payWay == "40")// 财付通
                {
                    string queryParam = string.Format("orderid={0}&total_tee={1}&userhostaddress={2}&attach={3}&busargs={4}&busdesc={5}&banktype={6}",
                                                      mOrder.OrderId, (mOrder.PayMoney * 100).ToString("F0"), Request.UserHostAddress, mUser.id.ToString(), payDetails, string.Format("{0}^{1}^{2}^{3}^{4}^{5}", mOrder.PNR, mOrder.Travel, mOrder.PassengerNumber, mUser.id.ToString(), mOrder.CreateUserName, "13800000000"), code);
                    url = string.Format("http://lzh.mypb.cn/Pay/TenPay.aspx?{0}", queryParam);
                    // url = string.Format("TenPay.aspx?{0}", queryParam);
                }

                #endregion
            }
            else
            {
                OnErrorNew("支付错误:" + payDetails, false);

                msgShow = string.IsNullOrEmpty(msgShow) ? "支付错误" : msgShow;
            }
        }
        catch (Exception ex)
        {
            msgShow = "支付异常";

            OnErrorNew(msgShow + ex.ToString(), false);
        }
        if (!string.IsNullOrEmpty(url))
        {
            Response.Redirect(url);
        }
        else
        {
            OnErrorNew(msgShow, false);
            Response.Write(msgShow);
        }
    }
コード例 #11
0
        /// <summary>
        /// 退款处理
        /// </summary>
        /// <param name="mOrder">订单 Model</param>
        /// <param name="uEmployees">用户 Model</param>
        /// <param name="uCompany">公司 Model</param>
        /// <returns></returns>
        public bool TitckOrderRefund(Tb_Ticket_Order mOrder, User_Employees uEmployees, User_Company uCompany, out string msg)
        {
            bool result = false;

            msg = "";

            try
            {
                if (mOrder.PayWay == 1 || mOrder.PayWay == 5)
                {
                    #region 支付宝

                    AliPay aliPay  = new AliPay();
                    string strTime = DateTime.Now.ToString("yyyyMMdd");

                    string bno = strTime + mOrder.OrderId + DateTime.Now.ToString("HHmm");

                    string detail_data = "";

                    string[] Details = new string[3];
                    Details[0] = bno; //批次号规则
                    Details[1] = "1"; //1.要退款的支付宝交易号
                    //2.退款参数
                    detail_data = mOrder.PayNo + "^" + mOrder.PayMoney.ToString("F2") + "^退款|" + "";

                    #region 分账信息

                    string tempSqlWhere = " OrderId='" + mOrder.OrderId + "'";
                    List <Tb_Order_PayDetail> payDetailList = new PbProject.Logic.Order.Tb_Order_PayDetailBLL().GetListBySqlWhere(tempSqlWhere);

                    payDetailList = bill.OnLinePayDetails(payDetailList);

                    #endregion 分账信息

                    Tb_Order_PayDetail payDetail    = null;
                    decimal            realPayMoney = 0;

                    for (int i = 0; i < payDetailList.Count; i++)
                    {
                        payDetail    = payDetailList[i];
                        realPayMoney = payDetail.RealPayMoney;

                        if (payDetail.PayType == "付款" || realPayMoney == 0)
                        {
                            continue;
                        }

                        detail_data += payDetail.PayAccount + "^^" + aliPay._serveremail + "^^" + realPayMoney.ToString("F2") + "^退" + payDetail.PayType + "|";
                    }
                    detail_data = detail_data.TrimEnd('|');
                    Details[2]  = detail_data;

                    result = aliPay.IsRefund(Details);

                    if (result)
                    {
                        bill.CreateBillRefundFailedLog(uEmployees, mOrder.OrderId, "提交退款成功,等待退款......"); //退款失败
                    }
                    else
                    {
                        bill.CreateBillRefundFailedLog(uEmployees, mOrder.OrderId, "提交退款失败"); //退款失败
                    }

                    #endregion
                }
                else if (mOrder.PayWay == 2 || mOrder.PayWay == 6)
                {
                    #region 快钱

                    _99Bill _99bill  = new _99Bill();
                    string  dataTime = DateTime.Now.ToString("yyyyMMddHHmmss");

                    string  detail_data = "";
                    decimal total       = mOrder.PayMoney;                              //退款金额

                    int orderPrice = int.Parse((total * 100).ToString().Split('.')[0]); //退款金额 分为单位
                    int tempPrice  = 0;

                    #region 分账信息

                    string tempSqlWhere = " OrderId='" + mOrder.OrderId + "'";
                    List <Tb_Order_PayDetail> payDetailList = new PbProject.Logic.Order.Tb_Order_PayDetailBLL().GetListBySqlWhere(tempSqlWhere);

                    payDetailList = bill.OnLinePayDetails(payDetailList);

                    #endregion 分账信息

                    Tb_Order_PayDetail payDetail    = null;
                    decimal            realPayMoney = 0;
                    int allTempPrice = 0;

                    for (int i = 0; i < payDetailList.Count; i++)
                    {
                        payDetail    = payDetailList[i];
                        realPayMoney = payDetail.RealPayMoney;

                        if (payDetail.PayType == "付款" || realPayMoney == 0)
                        {
                            continue;
                        }

                        tempPrice = int.Parse((realPayMoney * 100).ToString().Split('.')[0]);//退款金额 分为单位

                        //"1^[email protected]^5000^爱的|1^[email protected]^7000^分账1|1^[email protected]^8000^分账2";
                        // Details[3] = "1^" + LinkEmail + "^" + p2 + "^Refund|1^" + account + "^" + p1 + "^Refund";

                        detail_data += "1^" + payDetail.PayAccount + "^" + tempPrice + "^Refund|";

                        allTempPrice += tempPrice;
                    }
                    tempPrice    = orderPrice - allTempPrice;
                    detail_data += "1^" + _99bill.LinkEmail + "^" + tempPrice + "^Refund|"; //主账号退款 , 用于退款平衡

                    detail_data = detail_data.TrimEnd('|');

                    string[] Details = new string[6];

                    string OldOrderId = (string.IsNullOrEmpty(mOrder.OldOrderId)) ? mOrder.OrderId : mOrder.OldOrderId;
                    Details[0] = OldOrderId;                              // 订单编号(原订单号)
                    Details[1] = orderPrice.ToString();                   // 订单金额
                    Details[2] = "系统退款";                                  //备注
                    Details[3] = detail_data;                             //退款明细
                    Details[4] = mOrder.OrderId;                          // 订单编号(退废订单编号)
                    Details[5] = DateTime.Now.ToString("yyyyMMddHHmmss"); //退款流水号

                    string str = _99bill.Refund(Details);

                    //PbProject.WebCommon.Log.Log.RecordLog("RefundOper", str, false, null);//日志

                    result = _99bill.IsRefund(str);

                    if (result == true)
                    {
                        //退款成功,处理订单状态
                        string indexno = Details[5] + Details[4];  // 退款成功流水号
                        bill.CreateBillRefund(mOrder.OrderId, indexno, 2, "在线退款", "快钱退款", str);
                    }
                    else
                    {
                        //退款失败日志
                        bill.CreateBillRefundFailedLog(uEmployees, mOrder.OrderId, "退款失败,请检查:" + str); //退款失败
                    }

                    #endregion
                }
                else if (mOrder.PayWay == 3 || mOrder.PayWay == 7)
                {
                    #region 汇付

                    ChinaPnr chinaPnr = new ChinaPnr();

                    string dataTime = DateTime.Now.ToString("yyyyMMddHHmmss");

                    string  detail_data = "";
                    decimal total       = mOrder.PayMoney; //退款金额


                    #region 分账信息

                    string tempSqlWhere = " OrderId='" + mOrder.OrderId + "'";
                    List <Tb_Order_PayDetail> payDetailList = new PbProject.Logic.Order.Tb_Order_PayDetailBLL().GetListBySqlWhere(tempSqlWhere);

                    payDetailList = bill.OnLinePayDetails(payDetailList);

                    #endregion 分账信息

                    Tb_Order_PayDetail payDetail    = null;
                    decimal            realPayMoney = 0;

                    for (int i = 0; i < payDetailList.Count; i++)
                    {
                        payDetail    = payDetailList[i];
                        realPayMoney = payDetail.RealPayMoney;

                        if (payDetail.PayType == "付款" || realPayMoney == 0)
                        {
                            continue;
                        }

                        detail_data += "Agent:" + payDetail.PayAccount + ":" + realPayMoney.ToString("f2") + ";";
                    }

                    detail_data = detail_data.TrimEnd(';');

                    string strOrderOldID = string.IsNullOrEmpty(mOrder.OldOrderId) ? mOrder.OrderId : mOrder.OldOrderId;

                    string[] Details = new string[4];
                    Details[0] = mOrder.OrderId;   //订单编号
                    Details[1] = strOrderOldID;    //原订单编号
                    Details[2] = total.ToString(); //退款总金额
                    Details[3] = detail_data;      //退分润数据集

                    string value = chinaPnr.Refund(Details[0], Details[1], Details[2], Details[3]);

                    if (value.Contains("RespCode=000000") && value.Contains("ErrMsg=成功"))
                    {
                        result = true;
                    }

                    if (result == true)
                    {
                        string indexno = mOrder.OrderId;  // 退款成功流水号
                        bill.CreateBillRefund(mOrder.OrderId, indexno, 3, "在线退款", "汇付退款", value);
                    }
                    else
                    {
                        bill.CreateBillRefundFailedLog(uEmployees, mOrder.OrderId, "退款失败,请检查:" + value); //退款失败
                    }

                    #endregion
                }
                else if (mOrder.PayWay == 4 || mOrder.PayWay == 8 || mOrder.PayWay == 40)
                {
                    #region 财付通
                    // 财付通 暂时不处理
                    TenPayParam tenPayParam = new TenPayParam();
                    //内部订单号
                    tenPayParam.Orderid = mOrder.OrderId;
                    //旧订单号
                    if (!String.IsNullOrEmpty(mOrder.OldOrderId))
                    {
                        tenPayParam.OldOrderid = mOrder.OldOrderId;
                    }
                    else
                    {
                        tenPayParam.OldOrderid = mOrder.OrderId;
                    }
                    //财付通交易号
                    tenPayParam.PayNo = mOrder.PayNo;
                    //总金额
                    Tb_Ticket_Order tbTicketOrder = new PbProject.Logic.Order.Tb_Ticket_OrderBLL().GetTicketOrderByOrderId(tenPayParam.OldOrderid);
                    if (tbTicketOrder != null)
                    {
                        tenPayParam.Total_Tee = (tbTicketOrder.PayMoney * 100).ToString("F0");
                    }
                    else
                    {
                        tenPayParam.Total_Tee = (mOrder.PayMoney * 100).ToString("F0");
                    }
                    tenPayParam.Date = (mOrder.PayMoney * 100).ToString("F0");
                    /*---------------------分账信息----------------------------*/
                    string                    detail_data   = string.Format("{0}|", (mOrder.PayMoney * 100).ToString("F0"));
                    string                    tempSqlWhere  = " OrderId='" + mOrder.OrderId + "'";
                    Tb_Order_PayDetail        payDetail     = null;
                    decimal                   realPayMoney  = 0;
                    List <Tb_Order_PayDetail> payDetailList = new PbProject.Logic.Order.Tb_Order_PayDetailBLL().GetListBySqlWhere(tempSqlWhere);

                    /*
                     * for (int i = 0; i < payDetailList.Count; i++)
                     * {
                     *  payDetail = payDetailList[i];
                     *  if (payDetail.PayType == "付款")
                     *  {
                     *      tenPayParam.BackState = payDetail.A1;
                     *  }
                     *  if (payDetail.PayType == "手续费")
                     *  {
                     *      realPayMoney = payDetail.BuyPoundage;
                     *      detail_data += string.Format("{0}^{1}|", payDetail.PayAccount, (realPayMoney * 100).ToString("F0"));
                     *  }
                     * }
                     */
                    //
                    payDetailList = bill.OnLinePayDetails(payDetailList);
                    for (int i = 0; i < payDetailList.Count; i++)
                    {
                        payDetail    = payDetailList[i];
                        realPayMoney = payDetail.RealPayMoney;

                        if (payDetail.PayType == "付款")
                        {
                            tenPayParam.BackState = payDetail.A1;
                            continue;
                        }
                        detail_data += string.Format("{0}^{1}|", payDetail.PayAccount, (realPayMoney * 100).ToString("F0"));
                    }


                    detail_data = detail_data.TrimEnd('|');



                    //1000|(帐号^退款金额)|



                    /*----------------------------------------------------------*/
                    //退款分账
                    tenPayParam.Bus_Args = detail_data;
                    //分账退款
                    TenPay tenPay = new TenPay();
                    result = tenPay.ClientSplitRollback(tenPayParam);
                    #endregion
                }
                else if (mOrder.PayWay == 14)
                {
                    #region 账户支付

                    try
                    {
                        result = bill.CreateVirtualRefundBill(mOrder, uEmployees, uCompany, out msg);

                        if (!result)
                        {
                            //退款失败记录日志
                            bill.CreateBillRefundFailedLog(uEmployees, mOrder.OrderId, msg);
                        }
                    }
                    catch (Exception)
                    {
                        msg = "退款异常!";
                    }

                    #endregion
                }
                else if (mOrder.PayWay == 15)
                {
                    // 收银 暂时不处理
                    result = true;
                }
            }
            catch (Exception)
            {
            }

            return(result);
        }