Esempio n. 1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string       jsonstr = "";
            int          pid     = 0;
            StreamReader reader  = new StreamReader(Request.InputStream);
            String       xmlData = reader.ReadToEnd();//获取xml数据
            Dictionary <string, string> jsonlist = JMP.TOOL.xmlhelper.FromXmls(xmlData);

            if (jsonlist != null)
            {
                jsonstr = JMP.TOOL.JsonHelper.DictJsonstr(jsonlist);//把获取的参数转换成字符串
            }
            try
            {
                pid = !string.IsNullOrEmpty(Request.QueryString["pid"]) ? int.Parse(Request.QueryString["pid"].ToString()) : 0;
                if (jsonlist.Count > 0 && pid > 0)
                {
                    if (jsonlist["return_code"] == "SUCCESS")
                    {
                        JMALI.notice.notice notic = new notice.notice();
                        string key = notic.SelectKey(pid);//获取通道key值
                        Dictionary <string, string> list = jsonlist.Where(x => x.Key != "sign").ToDictionary(x => x.Key, x => x.Value);
                        string md5  = JMP.TOOL.UrlStr.AzGetStr(list) + "&key=" + key;;
                        string sing = JMP.TOOL.MD5.md5strGet(md5, true);
                        if (jsonlist["sign"] == sing && jsonlist["result_code"] == "SUCCESS")
                        {
                            decimal  o_price     = decimal.Parse((decimal.Parse(jsonlist["total_fee"]) / 100).ToString("f2"));                                    //支付金额(单位分转换成元)
                            DateTime gmt_payment = DateTime.ParseExact(jsonlist["time_end"], "yyyyMMddHHmmss", System.Globalization.CultureInfo.CurrentCulture);; //交易时间
                            string   message     = notic.PubNotice(jsonlist["out_trade_no"], o_price, gmt_payment, jsonlist["transaction_id"], jsonlist["transaction_id"], pid, "兴业银行", jsonstr);
                            if (message == "ok")
                            {
                                Response.Write("SUCCESS");
                            }
                            else
                            {
                                Response.Write("FAIL");
                            }
                        }
                        else
                        {
                            Response.Write("FAIL");
                        }
                    }
                    else
                    {
                        Response.Write("FAIL");
                    }
                }
                else
                {
                    Response.Write("FAIL");
                }
            }
            catch (Exception ex)
            {
                PayApiDetailErrorLogger.UpstreamNotifyErrorLog("获取到的参数:" + jsonstr + ",错误信息:" + ex, summary: "兴业银行通知接口错误", channelId: pid);
                Response.Write("FAIL");
            }
        }
Esempio n. 2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string jsonstr = "";
            int    pdpid   = 0;
            Dictionary <string, string> jsonlist = JMP.TOOL.UrlStr.GetRequestfrom(HttpContext.Current, "微派支付通知接口");

            if (jsonlist != null)
            {
                jsonstr = JMP.TOOL.JsonHelper.DictJsonstr(jsonlist);//把获取的参数转换成字符串
            }
            try
            {
                int pid     = !string.IsNullOrEmpty(Request.QueryString["pid"]) ? int.Parse(Request.QueryString["pid"].ToString()) : 0;
                int alpayid = !string.IsNullOrEmpty(ConfigurationManager.AppSettings["alpayid"].ToString()) ? int.Parse(ConfigurationManager.AppSettings["alpayid"].ToString()) : 0;
                //判断
                if (jsonlist["synType"] == "wxpay")
                {
                    pdpid = pid;
                }
                else
                {
                    pdpid = alpayid;
                }
                if (pdpid > 0)
                {
                    //获取通道key值
                    JMALI.notice.notice notic = new notice.notice();
                    string key = notic.SelectKey(pdpid);
                    Dictionary <string, string> dic = jsonlist.Where(x => x.Key != "sign").ToDictionary(x => x.Key, s => s.Value);
                    //签名
                    string   md5         = JMP.TOOL.UrlStr.AzGetStr(dic) + key;
                    string   signstr     = JMP.TOOL.MD5.md5strGet(md5, true).ToUpper();
                    DateTime gmt_payment = DateTime.ParseExact(jsonlist["time"].ToString(), "yyyyMMddHHmmss", System.Globalization.CultureInfo.CurrentCulture);
                    //判断
                    if (signstr == jsonlist["sign"].ToString() && jsonlist["status"].ToString() == "success")
                    {
                        string message = notic.PubNotice(jsonlist["cpparam"], decimal.Parse(jsonlist["price"]), gmt_payment, jsonlist["orderNo"], jsonlist["orderNo"], pdpid, "微派网络通知接口", jsonstr);
                        if (message == "ok")
                        {
                            Response.Write("success");
                        }
                        else
                        {
                            Response.Write("error");
                        }
                    }
                }
                else
                {
                    Response.Write("error");
                }
            }
            catch (Exception ex)
            {
                PayApiDetailErrorLogger.UpstreamNotifyErrorLog("获取到的参数:" + jsonstr + ",错误信息:" + ex, summary: "微派网络通知接口", channelId: pdpid);
                Response.Write("error");
            }
        }
Esempio n. 3
0
        /// <summary>
        /// 智付通知接口程序
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void Page_Load(object sender, EventArgs e)
        {
            string jsonstr = "";
            int    pid     = 0;
            Dictionary <string, string> jsonlist = UrlStr.GetRequestfrom(HttpContext.Current, "智付通知接口");

            if (jsonlist != null)
            {
                jsonstr = JsonHelper.DictJsonstr(jsonlist);//把获取的参数转换成字符串
            }
            try
            {
                pid = !string.IsNullOrEmpty(Request.QueryString["pid"]) ? int.Parse(Request.QueryString["pid"]) : 0;
                var callbackVerify = new CallbackVerify();
                var form           = Request.Form.AllKeys.ToDictionary(key => key, key => Request.Form[key]);
                if (pid > 0 && jsonlist.Count > 0)
                {
                    //商户订单号
                    string out_trade_no = jsonlist["order_no"].Trim();
                    //智付交易号
                    string trade_no = jsonlist["trade_no"].Trim();
                    //交易状态
                    string trade_status = jsonlist["trade_status"].Trim();
                    //买家账号
                    string buyer_email = jsonlist["merchant_code"].Trim();
                    //买家付款时间
                    DateTime gmt_payment = Convert.ToDateTime(jsonlist["trade_time"].Trim());
                    //实际支付金额
                    decimal o_price = decimal.Parse(jsonlist["order_amount"].Trim());
                    if (callbackVerify.Verify(form) && jsonlist["trade_status"].Trim() == "SUCCESS")
                    {
                        JMALI.notice.notice notic = new notice.notice();
                        string message            = notic.PubNotice(out_trade_no, o_price, gmt_payment, trade_no, buyer_email, pid, "智付通知接口", jsonstr);
                        if (message == "ok")
                        {
                            Response.Write("SUCCESS");
                        }
                        else
                        {
                            Response.Write("FAILED");
                        }
                    }
                    else
                    {
                        Response.Write("FAILED");
                    }
                }
                else
                {
                    Response.Write("FAILED");
                }
            }
            catch (Exception ex)
            {
                PayApiDetailErrorLogger.UpstreamNotifyErrorLog("获取到的参数:" + jsonstr + ",错误信息:" + ex, summary: "智付通知接口错误", channelId: pid);
                Response.Write("FAILED");
            }
        }
Esempio n. 4
0
        protected void Page_Load(object sender, EventArgs e)
        {
            int          pid      = 0;
            StreamReader reader   = new StreamReader(Request.InputStream);
            String       jsonData = reader.ReadToEnd();//获取数据

            try
            {
                RootObject obj = new RootObject();
                obj = JMP.TOOL.JsonHelper.Deserialize <RootObject>(jsonData);
                pid = !string.IsNullOrEmpty(Request.QueryString["pid"]) ? int.Parse(Request.QueryString["pid"].ToString()) : 0;
                if (pid > 0)
                {
                    JMALI.notice.notice notic = new notice.notice();
                    string key  = notic.SelectKey(pid);//获取通道key值
                    string json = JMP.TOOL.JsonHelper.Serialize(obj.info);
                    Dictionary <string, string> dic = JMP.TOOL.JsonHelper.DataRowJSON(json);
                    string signstr    = JMP.TOOL.UrlStr.AzGetStr(dic) + "&key=" + key;
                    string signstring = JMP.TOOL.MD5.md5strGet(signstr, true).ToLower();
                    if (obj != null && signstring == obj.sign)
                    {
                        if (obj.resultCode == "20000" && obj.info.pay_status == "TRADE_SUCCESS")
                        {
                            DateTime gmt_payment = DateTime.Now;
                            string   message     = notic.PubNotice(obj.info.pay_order, decimal.Parse(obj.info.pay_fee), gmt_payment, obj.info.transid, obj.info.transid, pid, "小小贝支付宝wap通知接口错误", jsonData);
                            if (message == "ok")
                            {
                                Response.Write("SUCCESS");
                            }
                            else
                            {
                                Response.Write("FAILURE");
                            }
                        }
                        else
                        {
                            Response.Write("FAILURE");
                        }
                    }
                    else
                    {
                        Response.Write("FAILURE");
                    }
                }
                else
                {
                    Response.Write("FAILURE");
                    PayApiDetailErrorLogger.UpstreamNotifyErrorLog("获取到的参数Pid错误:" + pid + "小小贝支付宝wap通知接口错误", channelId: pid);
                }
            }
            catch (Exception ex)
            {
                PayApiDetailErrorLogger.UpstreamNotifyErrorLog("获取到的参数:" + jsonData + ",错误信息:" + ex, summary: "小小贝支付宝wap通知接口错误", channelId: pid);
                Response.Write("FAILURE");
            }
        }
Esempio n. 5
0
        /// <summary>
        /// 南粤异步通知接口
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void Page_Load(object sender, EventArgs e)
        {
            string jsonstr = "";
            int    pid     = 0;
            Dictionary <string, string> jsonlist = JMP.TOOL.UrlStr.GetRequestJson(HttpContext.Current, "南粤通知接口");

            if (jsonlist != null)
            {
                jsonstr = JMP.TOOL.JsonHelper.DictJsonstr(jsonlist);//把获取的参数转换成字符串
            }
            try
            {
                pid = !string.IsNullOrEmpty(Request.QueryString["pid"]) ? int.Parse(Request.QueryString["pid"].ToString()) : 0;
                if (pid > 0 && jsonlist.Count > 0)
                {
                    //买家付款时间
                    DateTime gmt_payment = DateTime.ParseExact(jsonlist["transTime"].ToString(), "yyyyMMddHHmmss", CultureInfo.InvariantCulture);
                    //交易金额(单位:元)
                    decimal o_price = decimal.Parse(jsonlist["amount"]);
                    //获取通道key值
                    JMALI.notice.notice notic = new notice.notice();
                    string key = notic.SelectKey(pid);
                    //组装签名
                    Dictionary <string, string> list = jsonlist.Where(x => x.Key != "sign").ToDictionary(x => x.Key, x => x.Value);
                    string md5    = JMP.TOOL.UrlStr.AzGetStr(list) + "&key=" + key;
                    string md5str = JMP.TOOL.MD5.md5strGet(md5, true);
                    if (md5str == jsonlist["sign"] && jsonlist["status"] == "02")
                    {
                        string message = notic.PubNotice(jsonlist["outTradeNo"], o_price, gmt_payment, jsonlist["outChannelNo"], jsonlist["outChannelNo"], pid, "南粤通知接口", jsonstr);
                        if (message == "ok")
                        {
                            Response.Write("SUCCESS");
                        }
                        else
                        {
                            Response.Write("fail");
                        }
                    }
                    else
                    {
                        Response.Write("fail");
                    }
                }
                else
                {
                    Response.Write("fail");
                }
            }
            catch (Exception ex)
            {
                PayApiDetailErrorLogger.UpstreamNotifyErrorLog("获取到的参数:" + jsonstr + ",错误信息:" + ex, summary: "南粤通知接口错误", channelId: pid);
                Response.Write("fail");
            }
        }
Esempio n. 6
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string jsonstr = "";
            int    pid     = 0;

            jsonstr = JMP.TOOL.UrlStr.PostInput(HttpContext.Current, "现在通知接口");//获取通知参数(post数据流)
            jsonstr = HttpUtility.UrlDecode(jsonstr);
            try
            {
                string json = jsonstr.Replace("=", "\":\"").Replace("&", "\",\"");
                json = "{\"" + json + "\"}";
                Dictionary <string, string> jsonlist = JMP.TOOL.JsonHelper.Deserialize <Dictionary <string, string> >(json);
                pid = !string.IsNullOrEmpty(Request.QueryString["pid"]) ? int.Parse(Request.QueryString["pid"].ToString()) : 0;
                if (pid > 0 && jsonlist.Count > 0 && jsonlist["transStatus"] == "A001")
                {
                    //获取通道key值
                    JMALI.notice.notice notic = new notice.notice();
                    string key = notic.SelectKey(pid);
                    // string key = "1FZMAlAplOTamX6OARDVV8hrswhbGEVg";
                    Dictionary <string, string> list = jsonlist.Where(x => x.Key != "signature").ToDictionary(x => x.Key, x => x.Value);
                    string signstr = JMP.TOOL.UrlStr.AzGetStr(list) + "&" + JMP.TOOL.MD5.md5strGet(key, true).ToLower();
                    string sign    = JMP.TOOL.MD5.md5strGet(signstr, true).ToLower();
                    if (sign == jsonlist["signature"])
                    {
                        //交易金额(单位:分)
                        DateTime gmt_payment = DateTime.ParseExact(jsonlist["payTime"].ToString(), "yyyyMMddHHmmss", System.Globalization.CultureInfo.CurrentCulture);
                        decimal  o_price     = decimal.Parse((decimal.Parse(jsonlist["oriMhtOrderAmt"]) / 100).ToString("f2"));//支付金额(单位分转换成元)
                        string   message     = notic.PubNotice(jsonlist["mhtOrderNo"], o_price, gmt_payment, jsonlist["nowPayOrderNo"], jsonlist["channelOrderNo"], pid, "现在通知接口", jsonstr);
                        if (message == "ok")
                        {
                            Response.Write("success=Y");
                        }
                        else
                        {
                            Response.Write("fail");
                        }
                    }
                    else
                    {
                        Response.Write("fail");
                    }
                }
                else
                {
                    Response.Write("fail");
                }
            }
            catch (Exception ex)
            {
                PayApiDetailErrorLogger.UpstreamNotifyErrorLog("获取到的参数:" + jsonstr + ",错误信息:" + ex, summary: "现在通知接口", channelId: pid);
                Response.Write("fail");
            }
        }
Esempio n. 7
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string jsonstr = "";
            int    pid     = 0;
            Dictionary <string, string> jsonlist = JMP.TOOL.UrlStr.GetRequestGet(HttpContext.Current, "融梦通知接口");

            if (jsonlist != null)
            {
                jsonstr = JMP.TOOL.JsonHelper.DictJsonstr(jsonlist);//把获取的参数转换成字符串
            }
            try
            {
                pid = !string.IsNullOrEmpty(Request.QueryString["pid"]) ? int.Parse(Request.QueryString["pid"].ToString()) : 0;
                if (pid > 0 && jsonlist.Count > 0 && jsonlist["return_code"] == "0")
                {
                    //买家付款时间
                    DateTime gmt_payment = DateTime.Now;
                    //交易金额(单位:分)
                    decimal o_price = decimal.Parse((decimal.Parse(jsonlist["totalFee"]) / 100).ToString("f2"));//支付金额(单位分转换成元)
                    //获取通道key值
                    JMALI.notice.notice notic = new notice.notice();
                    string key = notic.SelecRmHdKey(pid);
                    //组装签名
                    string sign   = "channelOrderId=" + jsonlist["channelOrderId"] + "&key=" + key + "&orderId=" + jsonlist["orderId"] + "&timeStamp=" + jsonlist["timeStamp"] + "&totalFee=" + jsonlist["totalFee"];
                    string md5str = JMP.TOOL.MD5.md5strGet(sign, true).ToLower();
                    if (md5str == jsonlist["sign"])
                    {
                        string message = notic.PubNotice(jsonlist["channelOrderId"], o_price, gmt_payment, jsonlist["orderId"], jsonlist["orderId"], pid, "融梦通知接口", jsonstr);
                        if (message == "ok")
                        {
                            Response.Write("SUCCESS");
                        }
                        else
                        {
                            Response.Write("fail");
                        }
                    }
                    else
                    {
                        Response.Write("fail");
                    }
                }
                else
                {
                    Response.Write("fail");
                }
            }
            catch (Exception ex)
            {
                PayApiDetailErrorLogger.UpstreamNotifyErrorLog("获取到的参数:" + jsonstr + ",错误信息:" + ex, summary: "融梦通知接口", channelId: pid);
                Response.Write("fail");
            }
        }
Esempio n. 8
0
        public void callback(int pid)
        {
            //加载配置数据
            this.cfg = Utils.Load_CfgInterfaceId(pid);
            //初始化数据
            using (StreamReader sr = new StreamReader(Request.InputStream))
            {
                this.resHandler.setContent(sr.ReadToEnd());
                this.resHandler.setKey(this.cfg["key"]);

                Hashtable resParam = this.resHandler.getAllParameters();
                if (this.resHandler.isTenpaySign())
                {
                    if (int.Parse(resParam["status"].ToString()) == 0 && int.Parse(resParam["result_code"].ToString()) == 0)
                    {
                        //Utils.writeFile("接口回调", resParam); //通知返回参数写入result.txt文本文件。

                        //商户订单号

                        string out_trade_no = resParam["out_trade_no"].ToString();

                        //微付通交易号

                        string trade_no = resParam["transaction_id"].ToString();

                        //买家账号
                        string buyer_email = resParam["out_transaction_id"].ToString();

                        //买家付款时间
                        DateTime gmt_payment = DateTime.ParseExact(resParam["time_end"].ToString(), "yyyyMMddHHmmss", System.Globalization.CultureInfo.CurrentCulture);
                        //付款金额(单位分转换成元)
                        JMALI.notice.notice notic   = new notice.notice();
                        decimal             o_price = decimal.Parse((decimal.Parse(resParam["total_fee"].ToString()) / 100).ToString("f2"));
                        string message = notic.PubNotice(out_trade_no, o_price, gmt_payment, trade_no, buyer_email, pid, "威富通通知程序接口", JMP.TOOL.JsonHelper.Serialize(resParam));
                        if (message == "ok")
                        {
                            Response.Write("success");
                        }
                        else
                        {
                            Response.Write("fail");
                        }
                    }
                }
                else
                {
                    PayApiDetailErrorLogger.UpstreamNotifyErrorLog("获取到的参数:" + resParam, summary: "威富通通知接口错误", channelId: pid);
                    Response.Write("fail");
                }
            }
        }
Esempio n. 9
0
        /// <summary>
        /// 微唯网络通知接口
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void Page_Load(object sender, EventArgs e)
        {
            string jsonstr = "";
            int    pid     = 0;
            Dictionary <string, string> jsonlist = JMP.TOOL.UrlStr.GetRequestfrom(HttpContext.Current, "微唯支付通知接口");

            if (jsonlist != null)
            {
                jsonstr = JMP.TOOL.JsonHelper.DictJsonstr(jsonlist);//把获取的参数转换成字符串
            }
            try
            {
                pid = !string.IsNullOrEmpty(Request.QueryString["pid"]) ? int.Parse(Request.QueryString["pid"].ToString()) : 0;
                if (pid > 0)
                {
                    //订单号码
                    string order_id = jsonlist["order_id"];
                    //系统订单
                    string orderNo = jsonlist["orderNo"];
                    //支付金额
                    decimal money = decimal.Parse((decimal.Parse(jsonlist["money"]) / 100).ToString());
                    //商务号
                    string mch = jsonlist["mch"];
                    //支付类型
                    string pay_type = jsonlist["pay_type"];
                    //支付状态
                    string status = jsonlist["status"];
                    //签名
                    string sign = jsonlist["sign"];
                    //时间戳
                    string time = jsonlist["time"];
                    //获取通道key值
                    JMALI.notice.notice notic = new notice.notice();
                    string key = notic.SelectKey(pid);
                    //组装签名
                    string md5     = order_id + orderNo + jsonlist["money"] + mch + pay_type + time + JMP.TOOL.MD5.md5strGet(key, true).ToLower();
                    string signstr = JMP.TOOL.MD5.md5strGet(md5, true).ToLower();
                    if (signstr == sign && status == "1")
                    {
                        string message = notic.PubNotice(order_id, money, JMP.TOOL.WeekDateTime.GetTime(time), orderNo, orderNo, pid, "微唯网络通知接口", jsonstr);
                        if (message == "ok")
                        {
                            Response.Write("SUCCESS");
                        }
                        else
                        {
                            Response.Write("ERROR");
                        }
                    }
                    else
                    {
                        Response.Write("ERROR");
                    }
                }
                else
                {
                    Response.Write("ERROR");
                }
            }
            catch (Exception ex)
            {
                PayApiDetailErrorLogger.UpstreamNotifyErrorLog("获取到的参数:" + jsonstr + ",错误信息:" + ex, summary: "微唯网络通知接口", channelId: pid);
                Response.Write("ERROR");
            }
        }
Esempio n. 10
0
        /// <summary>
        /// 汇元通知接口程序
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void Page_Load(object sender, EventArgs e)
        {
            int    pid     = 0;
            string jsonstr = "";
            Dictionary <string, string> jsonlist = JMP.TOOL.UrlStr.GetRequestGet(HttpContext.Current, "汇元通知接口");

            if (jsonlist != null)
            {
                jsonstr = JMP.TOOL.JsonHelper.DictJsonstr(jsonlist);//把获取的参数转换成字符串
            }
            try
            {
                pid = !string.IsNullOrEmpty(Request.QueryString["pid"]) ? int.Parse(Request.QueryString["pid"].ToString()) : 0;
                if (pid > 0 && jsonlist.Count > 0)
                {
                    //订单编号
                    string userpara = jsonlist["agent_bill_id"].ToString().Trim();
                    //签名
                    string sign = jsonlist["sign"].ToString().Trim();
                    //第三方流水号
                    string trade_no = jsonlist["jnet_bill_no"].ToString();
                    //交易状态
                    string trade_status = jsonlist["result"].ToString();
                    //买家账号
                    string buyer_email = trade_no;
                    //买家付款时间
                    DateTime gmt_payment = DateTime.Now;
                    //交易金额(单位:元)
                    decimal             o_price = decimal.Parse(Request.QueryString["pay_amt"]);
                    var                 zf      = new JMP.BLL.jmp_interface();
                    JMALI.notice.notice notic   = new notice.notice();
                    string              key     = notic.SelectKey(pid);//获取通道key值
                    string              md5     = "result=" + trade_status + "&agent_id=" + jsonlist["agent_id"] + "&jnet_bill_no=" + trade_no + "&agent_bill_id=" + userpara + "&pay_type=" + Request.QueryString["pay_type"] + "&pay_amt=" + jsonlist["pay_amt"] + "&remark=" + jsonlist["remark"] + "&key=" + key;
                    string              md5str  = JMP.TOOL.MD5.md5strGet(md5, true).ToLower();
                    if (md5str == sign && trade_status == "1")
                    {
                        string message = notic.PubNotice(userpara, o_price, gmt_payment, trade_no, buyer_email, pid, "汇元通知接口", jsonstr);
                        if (message == "ok")
                        {
                            Response.Write("ok");
                        }
                        else
                        {
                            Response.Write("error");
                        }
                    }
                    else
                    {
                        Response.Write("error");
                    }
                }
                else
                {
                    Response.Write("error");
                }
            }
            catch (Exception ex)
            {
                PayApiDetailErrorLogger.UpstreamNotifyErrorLog("获取到的参数:" + jsonstr + ",错误信息:" + ex, summary: "汇元通知接口", channelId: pid);
                Response.Write("error");
            }
        }
Esempio n. 11
0
        protected void Page_Load(object sender, EventArgs e)

        {
            string       jsonstr = "";
            int          pid     = 0;
            StreamReader reader  = new StreamReader(Request.InputStream);
            String       xmlData = reader.ReadToEnd();//获取xml数据
            PAY_NODIFY   obj     = new PAY_NODIFY();

            jsonstr = xmlData.ToString();
            try
            {
                pid = !string.IsNullOrEmpty(Request.QueryString["pid"]) ? int.Parse(Request.QueryString["pid"].ToString()) : 0;
                obj = xmlhelper.Deserialize <PAY_NODIFY>(xmlData);
            }
            catch
            {
                PayApiDetailErrorLogger.UpstreamNotifyErrorLog("解析xml格式出错,获取到的xml数据:" + xmlData.ToString(), summary: "浦发银行通知接口错误", channelId: pid);

                obj = JsonHelper.Deserializes <PAY_NODIFY>(xmlData.Replace(" ", ""));
            }
            try
            {
                string signstr = string.IsNullOrEmpty(Request["sign"]) ? "" : Request["sign"];

                if (obj != null && !string.IsNullOrEmpty(signstr) && pid > 0)
                {
                    if (obj.STATE == "1")
                    {
                        JMALI.notice.notice notic = new notice.notice();
                        string key = notic.SelectKey(pid);                                            //获取通道key值

                        decimal price     = decimal.Parse((decimal.Parse(obj.AMT) / 100).ToString()); //支付金额(单位分转换成元)
                        string  mch_id    = obj.BUSI_ID;                                              //商户号(浦发账号)
                        string  code      = obj.CHARGE_CODE;                                          //商户订单号(我们平台编号)
                        string  timestamp = signstr.Split(':')[1];
                        string  signs     = timestamp + key + xmlData.Replace(" ", "").Replace("\t", "").Replace("\r\n", "").Replace("\n", "").Replace("\\", "");
                        string  sign      = JMP.TOOL.MD5.md5strGet(signs, true).ToLower() + ":" + timestamp;
                        if (signstr == sign)
                        {
                            DateTime gmt_payment = DateTime.Now;//交易时间
                            string   message     = notic.PubNotice(code, price, gmt_payment, obj.CHARGE_DOWN_CODE, obj.CHARGE_DOWN_CODE, pid, "浦发支付宝通知接口", jsonstr);
                            if (message == "ok")
                            {
                                Response.StatusCode = 200;
                                Response.Write("200");
                            }
                            else
                            {
                                Response.Write("fail");
                            }
                        }
                        else
                        {
                            Response.Write("fail");
                        }
                    }
                    else
                    {
                        Response.Write("fail");
                    }
                }
                else
                {
                    Response.Write("fail");
                }
            }
            catch (Exception ex)
            {
                PayApiDetailErrorLogger.UpstreamNotifyErrorLog("获取到的参数:" + jsonstr + ",错误信息:" + ex, summary: "浦发支付宝通知接口", channelId: pid);
                Response.Write("fail");
            }
        }
Esempio n. 12
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string jsonstr = "";
            int    pid     = 0;
            //var nameValue = JMP.TOOL.UrlStr.GetRequestfrom(HttpContext.Current, "掌趣支付通知接口");
            //Dictionary<string, string> jsonlist = nameValue.Cast<string>().ToDictionary(x => x, x => nameValue[x]);

            Dictionary <string, string> jsonlist = JMP.TOOL.UrlStr.GetRequestfrom(HttpContext.Current, "掌趣支付通知接口");

            if (jsonlist != null)
            {
                jsonstr = JMP.TOOL.JsonHelper.DictJsonstr(jsonlist);//把获取的参数转换成字符串
            }
            try
            {
                pid = !string.IsNullOrEmpty(Request.QueryString["pid"]) ? int.Parse(Request.QueryString["pid"].ToString()) : 0;
                if (pid > 0)
                {
                    //状态码
                    string reCode = jsonlist["reCode"];
                    //商户编号
                    string merchantNo = jsonlist["merchantNo"];
                    //商户订单号
                    string merchantOrderno = jsonlist["merchantOrderno"];
                    //订单状态
                    string result = jsonlist["result"];
                    //支付类型
                    string payType = jsonlist["payType"];
                    //商品名称
                    string memberGoods = HttpUtility.UrlDecode(jsonlist["memberGoods"]);
                    //成功金额
                    decimal amount = decimal.Parse(jsonlist["amount"]); //单位:元,保留两位小数
                    //签名数据
                    string hmac = jsonlist["hmac"];
                    //获取通道key值
                    JMALI.notice.notice notic = new notice.notice();
                    string key = notic.SelectKey(pid);
                    //组装签名
                    string md5 = reCode + merchantNo + merchantOrderno + result + payType + memberGoods + amount;
                    //签名
                    string signstr = JMP.TOOL.Digest.HmacSign(md5, key);
                    if (signstr == hmac && reCode == "1" && result == "SUCCESS")
                    {
                        DateTime time_payment = DateTime.Now;
                        string   message      = notic.PubNotice(merchantOrderno, amount, time_payment, merchantOrderno, merchantOrderno, pid, "掌趣支付通知接口", jsonstr);
                        if (message == "ok")
                        {
                            Response.Write("SUCCESS");
                        }
                        else
                        {
                            Response.Write("FAIL");
                        }
                    }
                    else
                    {
                        Response.Write("FAIL");
                    }
                }
                else
                {
                    Response.Write("FAIL");
                }
            }
            catch (Exception ex)
            {
                PayApiDetailErrorLogger.UpstreamNotifyErrorLog("获取到的参数:" + jsonstr + ",错误信息:" + ex, summary: "掌趣支付通知接口", channelId: pid);
                Response.Write("FAIL");
            }
        }
Esempio n. 13
0
        /// <summary>
        /// 优乐通知接口
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void Page_Load(object sender, EventArgs e)
        {
            string       jsonstr = "";
            int          pid     = 0;
            StreamReader reader  = new StreamReader(Request.InputStream);
            String       xmlData = reader.ReadToEnd();//获取xml数据
            Dictionary <string, string> jsonlist = new Dictionary <string, string>();

            try
            {
                pid      = !string.IsNullOrEmpty(Request.QueryString["pid"]) ? int.Parse(Request.QueryString["pid"].ToString()) : 0;
                jsonlist = JMP.TOOL.xmlhelper.FromXmls(xmlData);
            }
            catch
            {
                PayApiDetailErrorLogger.UpstreamNotifyErrorLog("解析xml格式出错,获取到的xml数据:" + xmlData.ToString(), summary: "优乐通知接口错误", channelId: pid);
                jsonlist = JMP.TOOL.xmlhelper.FromXmls(xmlData.Replace(" ", ""));
            }
            if (jsonlist != null)
            {
                jsonstr = JMP.TOOL.JsonHelper.DictJsonstr(jsonlist);//把获取的参数转换成字符串
            }
            try
            {
                if (jsonlist.Count > 0 && pid > 0)
                {
                    if (jsonlist["return_code"] == "SUCCESS" && jsonlist["result_code"] == "SUCCESS")
                    {
                        JMALI.notice.notice notic = new notice.notice();
                        string key = notic.SelectKey(pid);                                                       //获取通道key值

                        decimal price  = decimal.Parse((decimal.Parse(jsonlist["total_fee"]) / 100).ToString()); //支付金额(单位分转换成元)
                        string  mch_id = jsonlist["mch_id"];                                                     //商户号(优乐账号)
                        string  code   = jsonlist["out_trade_no"];                                               //商户订单号(我们平台编号)
                        string  sign   = JMP.TOOL.MD5.md5strGet(mch_id + code + key, true).ToUpper();            //组装签名验证
                        if (jsonlist["attach"] == sign)
                        {
                            DateTime gmt_payment = DateTime.ParseExact(jsonlist["time_end"], "yyyyMMddHHmmss", System.Globalization.CultureInfo.CurrentCulture);; //交易时间
                            string   message     = notic.PubNotice(code, price, gmt_payment, jsonlist["transaction_id"], jsonlist["transaction_id"], pid, "优乐支付接口", jsonstr);
                            if (message == "ok")
                            {
                                Response.Write("success");
                            }
                            else
                            {
                                Response.Write("fail");
                            }
                        }
                        else
                        {
                            Response.Write("fail");
                        }
                    }
                    else
                    {
                        Response.Write("fail");
                    }
                }
                else
                {
                    Response.Write("fail");
                }
            }
            catch (Exception ex)
            {
                PayApiDetailErrorLogger.UpstreamNotifyErrorLog("获取到的参数:" + jsonstr + ",错误信息:" + ex, summary: "优乐通知接口错误", channelId: pid);
                Response.Write("fail");
            }
        }