Esempio n. 1
0
        /// <summary>
        /// 账号签约查询
        /// </summary>
        /// <param name="payType"></param>
        /// <param name="payAct"></param>
        /// <returns></returns>
        public string GetSign(string payType, string payAct)
        {
            string result = "";

            try
            {
                if (payType == "1")
                {
                    PbProject.Logic.Pay.AliPay aliPay = new PbProject.Logic.Pay.AliPay();
                    result = aliPay.GetUserSign(payAct);
                }
                else if (payType == "2")
                {
                    //快钱
                }
                else if (payType == "3")
                {
                    PbProject.Logic.Pay.ChinaPnr chinaPnr = new PbProject.Logic.Pay.ChinaPnr();
                    result = chinaPnr.Sign(payAct, payAct);
                }
                else if (payType == "4")
                {
                    //财付通
                }
                else
                {
                    result = "";
                }
            }
            catch (Exception)
            {
            }
            return(result);
        }
Esempio n. 2
0
        /// <summary>
        /// 账号余额查询
        /// </summary>
        /// <param name="payType"></param>
        /// <param name="payAct"></param>
        /// <returns></returns>
        public string QueryBalance(string payType, string payAct, out string msgShow)
        {
            msgShow = "";
            string result = "";

            try
            {
                if (payType == "3")
                {
                    PbProject.Logic.Pay.ChinaPnr chinaPnr = new PbProject.Logic.Pay.ChinaPnr();
                    result = chinaPnr.QueryBalance(payAct);
                    string[] strValues = result.Split(new string[] { "<br/>", "\r" }, StringSplitOptions.RemoveEmptyEntries);

                    foreach (string item in strValues)
                    {
                        if (!string.IsNullOrEmpty(item))
                        {
                            if (item.Contains("AcctBal"))
                            {
                                msgShow = "账户( " + payAct + " )余额 : " + item.Split('=')[1] + " 元 ";
                                break;
                            }
                        }
                    }
                }
                else
                {
                    msgShow = "暂时只支持汇付!";
                }
            }
            catch (Exception)
            {
            }
            return(result);
        }
Esempio n. 3
0
        /// <summary>
        /// 账号签约查询
        /// </summary>
        /// <param name="payType"></param>
        /// <param name="payAct"></param>
        /// <returns></returns>
        public bool QuerySign(string payType, string payAct)
        {
            bool result = false;

            try
            {
                if (payType == "1")
                {
                    PbProject.Logic.Pay.AliPay aliPay = new PbProject.Logic.Pay.AliPay();
                    result = aliPay.IsUserSign(payAct);
                }
                else if (payType == "2")
                {
                    //快钱
                }
                else if (payType == "3")
                {
                    PbProject.Logic.Pay.ChinaPnr chinaPnr = new PbProject.Logic.Pay.ChinaPnr();
                    result = chinaPnr.QuerySign(payAct, payAct);
                }
                else if (payType == "4")
                {
                    //财付通
                }
                else
                {
                    result = false;
                }
            }
            catch (Exception)
            {
            }
            return(result);
        }
Esempio n. 4
0
        /// <summary>
        /// 退款查询
        /// </summary>
        /// <param name="payType">支付方式</param>
        /// <param name="oldOrderId">原支付订单号</param>
        /// <param name="newOrderId">退款订单号</param>
        /// <param name="onlineNo">在线交易号 、退款流水号</param>
        /// <returns></returns>
        public string RefundSel(string payType, string oldOrderId, string newOrderId, string onlineNo, out string msgShow)
        {
            string returnValue = "";

            msgShow = "";
            try
            {
                if (payType == "1" || payType == "5")
                {
                    #region 支付宝

                    PbProject.Logic.Pay.AliPay alipay = new PbProject.Logic.Pay.AliPay();
                    msgShow = (string.IsNullOrEmpty(onlineNo) || onlineNo.Length != 16) ? "请正确输入交易号!" : msgShow;

                    if (msgShow == "")
                    {
                        string   str  = alipay.QueryRefundResultStr(onlineNo);
                        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"))
                                {
                                    //退款成功
                                    msgShow = "退款成功!银行卡 2 - 7个工作日到账,信用卡 2 - 14 个工作日到账!";
                                    break;
                                }
                            }
                        }
                        returnValue = str + "<br/>" + msgShow + "<br/>";
                    }

                    #endregion
                }
                else if (payType == "2" || payType == "6")
                {
                    #region 快钱

                    msgShow = (string.IsNullOrEmpty(newOrderId)) ? "请输入订单号!" : msgShow;
                    msgShow = (string.IsNullOrEmpty(oldOrderId)) ? "请输入原订单号!" : msgShow;
                    msgShow = (string.IsNullOrEmpty(onlineNo)) ? "请输入退款流水号!" : msgShow;

                    if (msgShow == "")
                    {
                        PbProject.Logic.Pay._99Bill bill = new PbProject.Logic.Pay._99Bill();

                        string[] strOrderNoS = onlineNo.Split('|');


                        for (int i = 0; i < strOrderNoS.Length; i++)
                        {
                            if (!string.IsNullOrEmpty(strOrderNoS[i]))
                            {
                                // strOrderNoS[i]; //快钱退款流水号

                                string str = bill.GetRefund(oldOrderId, strOrderNoS[i]);

                                if (str != null && str.Contains("<result>10</result>"))
                                {
                                    msgShow      = "退款成功!银行卡 2 - 7个工作日到账,信用卡 2 - 14 个工作日到账!";
                                    returnValue += str + "<br/>" + msgShow + "<br/>";
                                    break;
                                }
                                else if (str != null && (str.Contains("<result>00</result>") && str.Contains("<errCode></errCode>")))
                                {
                                    msgShow      = "退款进行中!需等待快钱审核!银行卡 2 - 7个工作日到账,信用卡 2 - 14 个工作日到账!";
                                    returnValue += str + "<br/>" + msgShow + "<br/>";
                                    break;
                                }
                                else
                                {
                                    msgShow      = "退款失败!";
                                    returnValue += str + "<br/>" + msgShow + "<br/>";
                                }
                            }
                        }
                    }
                    #endregion
                }
                else if (payType == "3" || payType == "7")
                {
                    #region 汇付

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

                    msgShow = (string.IsNullOrEmpty(onlineNo)) ? "请输入退款流水号!" : msgShow;

                    if (msgShow == "")
                    {
                        string[] strOrderNoS = onlineNo.Split('|');

                        for (int i = 0; i < strOrderNoS.Length; i++)
                        {
                            if (!string.IsNullOrEmpty(strOrderNoS[i]))
                            {
                                // strOrderNoS[i]; //汇付 退款订单号
                                //string str = chinaPnr.QueryRefundStatus(strOrderNoS[i]).Replace("#", "<br/>\n");
                                string str = chinaPnr.QueryRefundStatus(strOrderNoS[i]);

                                if (str != null && str.Contains("RespCode=000000") && str.Contains("ErrMsg=退款交易已成功"))
                                {
                                    msgShow      = " 退款成功!银行卡 2 - 7个工作日到账,信用卡 2 - 14 个工作日到账!";
                                    returnValue += str + "<br/>" + msgShow + "<br/>";
                                    break;
                                }
                                else if (str != null && str.Contains("RespCode=000000") && str.Contains("ErrMsg=退款交易,已扣款,系统处理中"))
                                {
                                    msgShow      = " 退款成功,退款中!银行卡 2 - 7个工作日到账,信用卡 2 - 14 个工作日到账!";
                                    returnValue += str + "<br/>" + msgShow + "<br/>";
                                    break;
                                }
                                else
                                {
                                    msgShow      = " 退款失败!";
                                    returnValue += str + "<br/>" + msgShow + "<br/>";
                                }
                            }
                        }
                    }
                    #endregion
                }
                else if (payType == "4" || payType == "8" || payType == "40")
                {
                    #region 财付通
                    TenPayParam tenPayParam = new TenPayParam();
                    tenPayParam.Orderid    = newOrderId;
                    tenPayParam.OldOrderid = oldOrderId;
                    tenPayParam.PayNo      = onlineNo;
                    tenPayParam.Date       = DateTime.Now.ToString("yyyyMMdd");
                    returnValue            = new TenPay().ClientSplitInquire(tenPayParam);
                    #endregion
                }
                else
                {
                    msgShow = "请选择支付方式";
                }
            }
            catch (Exception)
            {
            }
            return(returnValue);
        }
Esempio n. 5
0
        /// <summary>
        /// 支付查询
        /// </summary>
        /// <param name="payType">支付方式</param>
        /// <param name="oldOrderId">订单号</param>
        ///  <param name="IsOperOrder">true:更新订单等信息 、false:不跟新订单等信息</param>
        /// <param name="oldOrderId">out:提示消息</param>
        /// <returns></returns>
        public string PaySel(string payType, string oldOrderId, bool IsOperOrder, out string msgShow)
        {
            string strValue = "";

            msgShow = "";

            try
            {
                string  PayNo    = ""; //交易号
                decimal PayMoney = 0;  //交易金额

                PbProject.Logic.Pay.Bill payBill = new PbProject.Logic.Pay.Bill();

                if (payType == "1")
                {
                    msgShow += "支付宝:";

                    #region 支付宝

                    PbProject.Logic.Pay.AliPay aliPay = new PbProject.Logic.Pay.AliPay();

                    strValue = aliPay.TradeQuery(oldOrderId);

                    if (strValue.Contains("<error>TRADE_NOT_EXIST</error>"))
                    {
                        msgShow += "查询失败";
                    }
                    else if (strValue.Contains("<trade_status>TRADE_SUCCESS</trade_status>"))
                    {
                        msgShow += "交易成功";

                        XElement root = XElement.Parse(strValue);

                        if (root.Element("response") != null)
                        {
                            XElement xe = root.Element("response");

                            if (xe.Element("trade") != null)
                            {
                                XElement xe1 = xe.Element("trade");

                                //交易号
                                if (xe1.Element("trade_no") != null)
                                {
                                    PayNo    = xe1.Element("trade_no").Value;
                                    msgShow += " , 交易号:" + PayNo;
                                }

                                //交易金额
                                if (xe1.Element("total_fee") != null)
                                {
                                    PayMoney = decimal.Parse(xe1.Element("total_fee").Value);
                                    msgShow += " , 订单支付金额:" + PayMoney.ToString("f2");
                                }
                            }
                        }


                        if (IsOperOrder && msgShow.Contains("交易成功"))
                        {
                            payBill.CreateBillPayBill(oldOrderId, PayNo, 1, "", "在线支付", "支付宝支付", ""); // 支付
                        }
                    }
                    else
                    {
                        msgShow += "支付宝 未付";
                    }



                    #endregion

                    strValue = "支付宝查询结果:" + strValue;
                }
                else if (payType == "2")
                {
                    msgShow += "快钱:";

                    #region 快钱

                    PbProject.Logic.Pay._99Bill bill = new PbProject.Logic.Pay._99Bill();
                    strValue = bill.GetPayReturn(oldOrderId);

                    if (strValue.Contains("<payResult>10</payResult>"))
                    {
                        msgShow += "交易成功";
                        XElement root = XElement.Parse(strValue);
                        //交易号
                        if (root.Element("dealId") != null)
                        {
                            PayNo    = root.Element("dealId").Value;
                            msgShow += " , 交易号:" + PayNo;
                        }
                        //支付金额
                        if (root.Element("payAmount") != null)
                        {
                            PayMoney = decimal.Parse(root.Element("payAmount").Value);
                            PayMoney = PayMoney / 100;
                            msgShow += " , 订单支付金额:" + PayMoney.ToString("f2");
                        }
                        if (IsOperOrder && msgShow.Contains("交易成功"))
                        {
                            payBill.CreateBillPayBill(oldOrderId, PayNo, 2, "", "在线支付", "快钱支付", ""); // 支付
                        }
                        if (strValue.Contains("<sharingStatus>10</sharingStatus>"))
                        {
                            msgShow += ",分账成功";
                        }
                        else
                        {
                            msgShow += ",分账失败";
                        }
                    }
                    else
                    {
                        msgShow += "快钱 未付";
                    }
                    #endregion

                    strValue = "快钱查询结果:" + strValue;
                }
                else if (payType == "3")
                {
                    msgShow += "汇付:";

                    #region 汇付

                    PbProject.Logic.Pay.ChinaPnr chinaPnr = new PbProject.Logic.Pay.ChinaPnr();
                    strValue = chinaPnr.QueryStatus(oldOrderId);
                    if (strValue.Contains("CmdId=QueryStatus") && strValue.Contains("RespCode=000000") && strValue.Contains("已支付"))
                    {
                        msgShow += "交易成功";
                        msgShow += " , 交易号:" + DateTime.Now.ToString("yyyyMMddHHmmss");
                        msgShow += " , 订单支付金额:见订单";

                        if (IsOperOrder && msgShow.Contains("交易成功"))
                        {
                            payBill.CreateBillPayBill(oldOrderId, PayNo, 3, "", "在线支付", "汇付支付", ""); // 支付
                        }
                    }
                    else
                    {
                        msgShow += "汇付 未付";
                    }

                    #endregion

                    strValue = "汇付查询结果:" + strValue;
                }
                else if (payType == "4")
                {
                    msgShow += "财付通:";

                    #region 财付通
                    msgShow += "财付通暂时不支付查询";
                    #endregion

                    strValue = "汇付查询结果:" + msgShow;
                }
                else
                {
                    msgShow = "请选择支付方式";
                }
            }
            catch (Exception)
            {
            }
            return(strValue);
        }