Пример #1
0
        /// <summary>
        /// 功能描述:处理万通的返回结果
        /// 创建  人:周文卿
        /// 创建时间:2019-02-19
        /// </summary>
        /// <param name="result">请求结果</param>
        /// <param name="transactionnum">流水号</param>
        /// <param name="OrderID">订单号</param>
        /// <param name="ratecode">支付代码</param>
        /// <returns></returns>
        public rerurnpram ResultQJ(string result, string ratecode, string transactionnum, string OrderID)
        {
            JToken     rejson     = JToken.Parse(result);
            string     aa         = rejson["payment"].ToString();
            rerurnpram rerurnpram = new rerurnpram();
            int        i          = 0;

            if (aa == "True")
            {
                rerurnpram.message = "支付中";
                switch (ratecode)
                {
                case "101":
                    RuleAlipay alipay = new RuleAlipay();
                    i = alipay.insertAlipay(OrderID, transactionnum, rejson["payUrl"].ToString(), DateTime.Now);
                    if (i == 0)
                    {
                        rerurnpram.message = "支付失败";
                    }
                    break;

                case "103":
                    RuleWeixinpay weixinpay = new RuleWeixinpay();
                    i = weixinpay.insertweixinpay(OrderID, transactionnum, rejson["payUrl"].ToString(), DateTime.Now);
                    if (i == 0)
                    {
                        rerurnpram.message = "支付失败";
                    }
                    break;

                case "119":
                    RuleJDpay ruleJDpay = new RuleJDpay();
                    rerurnpram.urlcode = rejson["payUrl"].ToString();
                    i = ruleJDpay.insertjdpay(OrderID, transactionnum, rejson["payUrl"].ToString(), DateTime.Now);
                    if (i == 0)
                    {
                        rerurnpram.message = "支付失败";
                    }
                    break;
                }
            }
            else
            {
                rerurnpram.message = rejson["message"].ToString();

                messageLog.inserttblPayfailMessageLog("万通", "1550473045", rerurnpram.message, transactionnum, OrderID, DateTime.Now, result);
            }
            return(rerurnpram);
        }
Пример #2
0
        /// <summary>
        /// 汇通代付查询返回的结果
        /// </summary>
        /// <returns></returns>
        public string Query_HTSUb(string result)
        {
            try
            {
                string retext = "";
                Dictionary <string, string> valuePairs = new Dictionary <string, string>();
                //先按& 转换成数组
                string[] jsontext = result.Split('&');
                RuletblPayfailMessageLog messageLog = new RuletblPayfailMessageLog();
                messageLog.inserttblPayfailMessageLog("亿点", "888017", "查询代付", "代付", result, DateTime.Now, result);
                for (int i = 0; i < jsontext.Length; i++)
                {
                    //在进行=的截取 获得key值很Value值
                    string[] keyvalue = jsontext[i].Split('=');
                    valuePairs.Add(keyvalue[0], keyvalue[1]);
                }
                //判断是否成功
                if (valuePairs["RspCod"].ToString() == "00000")
                {
                    string fldChannelnum = valuePairs["TxSN"].ToString();
                    RuletblChannelinformation ruletbl = new RuletblChannelinformation();
                    DataSet alldt = ruletbl.selechannebycidsub(fldChannelnum);

                    //渠道信息表
                    DataTable dt = alldt.Tables[0];
                    //订单表
                    DataTable oerderdt = alldt.Tables[1];
                    //商户表
                    DataTable Merchant = alldt.Tables[2];
                    //判断数据库里面是否有订单号
                    if (oerderdt.Rows.Count > 0)
                    {
                        //判断状态 如果是3和4 标记为异常 不退款 由人工审核
                        if (valuePairs["Status"].ToString() == "3")
                        {
                            RuletblAgentPay ruletblAgent = new RuletblAgentPay();
                            bool            IsSuccess    = false;
                            ruletblAgent.updatestate(oerderdt.Rows[0]["fldMerchID"].ToString(), fldChannelnum, "异常", out IsSuccess);
                            if (!IsSuccess)
                            {
                                retext = "error";
                            }
                            else
                            {
                                retext = "ok";
                            }
                        }
                        //如果是1 修改状态 扣款
                        if (valuePairs["Status"].ToString() == "1" && oerderdt.Rows[0]["fldPayState"].ToString() != "代付成功")
                        {
                            RuletblAgentPay ruleOldOrdertable = new RuletblAgentPay();
                            bool            IsSuccess         = false;
                            DataTable       dataTable         = ruleOldOrdertable.updatestate(oerderdt.Rows[0]["fldMerchID"].ToString(), fldChannelnum, "代付成功", out IsSuccess, decimal.Parse(valuePairs["EntrustPayAmt"].ToString()) / 100);
                            if (!IsSuccess)
                            {
                                retext = "error";
                            }
                            else
                            {
                                retext = "ok";
                            }
                        }
                        else
                        {
                            retext = "error";
                        }
                    }
                    else
                    {
                        retext = "error";
                    }
                }

                return(retext);
            }
            catch (Exception e)
            {
                throw new InsertException(e.Message, "QueryRetuenResult", "Query_HTSUb", result);
            }
        }
Пример #3
0
        /// <summary>
        /// 海付代付查询返回的结果
        /// </summary>
        /// <returns></returns>
        public string Query_HFSUb(string result, string orid)
        {
            try
            {
                string retext = "error";

                //先按& 转换成数组
                JToken jToken = JsonConvert.DeserializeObject(result) as JObject;

                RuletblPayfailMessageLog messageLog = new RuletblPayfailMessageLog();
                messageLog.inserttblPayfailMessageLog("海付", "734641", "查询代付", "代付", result, DateTime.Now, result);

                if (jToken["respCode"].ToString() == "0000")
                {
                    string fldChannelnum = jToken["pay_number"].ToString();
                    RuletblChannelinformation ruletbl = new RuletblChannelinformation();
                    DataSet alldt = ruletbl.selechannebycidsub(fldChannelnum);

                    //渠道信息表
                    DataTable dt = alldt.Tables[0];
                    //订单表
                    DataTable oerderdt = alldt.Tables[1];
                    //商户表
                    DataTable Merchant = alldt.Tables[2];

                    //判断是否成功
                    if (jToken["status"].ToString() == "00")
                    {
                        //判断数据库里面是否有订单号
                        if (oerderdt.Rows.Count > 0 && oerderdt.Rows[0]["fldPayState"].ToString() != "代付成功")
                        {
                            RuletblAgentPay ruleOldOrdertable = new RuletblAgentPay();
                            bool            IsSuccess         = false;
                            DataTable       dataTable         = ruleOldOrdertable.updatestate(oerderdt.Rows[0]["fldMerchID"].ToString(), fldChannelnum, "代付成功", out IsSuccess, decimal.Parse(oerderdt.Rows[0]["fldPayAmount"].ToString()));
                            if (!IsSuccess)
                            {
                                retext = "error";
                            }
                            else
                            {
                                retext = "ok";
                            }
                        }
                        else
                        {
                            retext = "error";
                        }
                    }
                    if (jToken["status"].ToString() == "02")
                    {
                        RuletblAgentPay ruletblAgent = new RuletblAgentPay();
                        bool            IsSuccess    = false;
                        ruletblAgent.updatestate(oerderdt.Rows[0]["fldMerchID"].ToString(), fldChannelnum, "异常", out IsSuccess);
                        if (!IsSuccess)
                        {
                            retext = "error";
                        }
                        else
                        {
                            retext = "ok";
                        }
                    }
                }



                return(retext);
            }
            catch (Exception e)
            {
                throw new InsertException(e.Message, "QueryRetuenResult", "Query_HFSUb", result);
            }
        }
Пример #4
0
        /// <summary>
        /// 万通代付查询返回的结果
        /// </summary>
        /// <returns></returns>
        public string Query_QJSUb(string result)
        {
            try
            {
                string Ownresult = "error";
                JToken rejson    = JToken.Parse(result);
                messageLog.inserttblPayfailMessageLog("万通", "1550473045", "查询代付", "代付", result, DateTime.Now, result);
                string aa = rejson["status"].ToString();
                if (aa == "True")
                {
                    string statecode = rejson["resp_code"].ToString();

                    string fldChannelnum = rejson["order_no"].ToString();
                    RuletblChannelinformation ruletbl = new RuletblChannelinformation();
                    DataSet alldt = ruletbl.selechannebycidsub(fldChannelnum);

                    //渠道信息表
                    DataTable dt = alldt.Tables[0];
                    //订单表
                    DataTable oerderdt = alldt.Tables[1];
                    //商户表
                    DataTable Merchant = alldt.Tables[2];

                    //代付失败 修改成异常状态
                    if (statecode == "F")
                    {
                        RuletblAgentPay ruletblAgent = new RuletblAgentPay();
                        bool            IsSuccess    = false;
                        ruletblAgent.updatestate(oerderdt.Rows[0]["fldMerchID"].ToString(), fldChannelnum, "异常", out IsSuccess);
                        if (!IsSuccess)
                        {
                            Ownresult = "error";
                        }
                        else
                        {
                            Ownresult = "ok";
                        }
                    }
                    //代付成功 且异步还没有通知
                    if (statecode == "S" && oerderdt.Rows[0]["fldPayState"].ToString() != "代付成功")
                    {
                        RuletblAgentPay ruleOldOrdertable = new RuletblAgentPay();
                        bool            IsSuccess         = false;
                        DataTable       dataTable         = ruleOldOrdertable.updatestate(oerderdt.Rows[0]["fldMerchID"].ToString(), fldChannelnum, "代付成功", out IsSuccess, decimal.Parse(rejson["order_amount"].ToString()));
                        if (!IsSuccess)
                        {
                            Ownresult = "error";
                        }
                        else
                        {
                            Ownresult = "ok";
                        }
                    }
                    else
                    {
                        Ownresult = "ok";
                    }
                }
                return(Ownresult);
            }
            catch (Exception e)
            {
                throw new InsertException(e.Message, "QueryRetuenResult", "Query_HTSUb", result);
            }
        }