Exemplo n.º 1
0
        public string getCatalog(string catalogName)
        {
            coockie = new CookieContainer();
            string        strmd5 = merchantID + key;
            string        sign   = Md5Helper.GetMD5String_utf8(strmd5);
            StringBuilder str    = new StringBuilder();

            str.AppendFormat("MerchantI={0}", merchantID);
            str.AppendFormat("&Sign={0}", sign);  //数字签名(MerchantID+ key)

            string result = PostAndGet.HttpPostString(getCatalogUrl, str.ToString(), ref coockie);

            Regex           re = new Regex(@"<No>(.*?)</No>\s+<Name>(.*?)</Name>
", RegexOptions.None);
            MatchCollection mc = re.Matches(result);

            foreach (Match ma in mc)
            {
                if (ma.Groups[2].Value.ToString().Contains("catalogName"))
                {
                    return(ma.Groups[1].Value);
                }
            }

            return(null);
        }
Exemplo n.º 2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string key = "75e2ae34888644289751ee1082538d2b";

            string SupOrderID = Request["SupOrderID"]; //系统内部订单号
            string OrderID    = Request["OrderID"];    //下游自定义订单号
            string Status     = Request["Status"];     //充值状态
            string DetailMsg  = Request["DetailMsg"];  //供货商返回充值详情
            string Sign       = Request["Sign"];       //数字签名 Md5(SupOrderID+OrderID+ Status+ key)
            string StatusNo   = Request["StatusNo"];   //充值状态的编号 数字,跟上面的Status中文一一对应0:充值成功 1:充值失败 2:处理中 3:可疑订单
            string Sign2      = Request["Sign2"];      //另外一组数字签名  Md5(SupOrderID+OrderID+ StatusNo + key)
            string Cards      = Request["Cards"];      //卡密类订单的卡密信息 类似这样的多组数据可以自行解析,[{'No':'2055029031001601','PassWord':'******','ExpireTime':'2018-12-22   00:00:00'}]

            WriteLog.Write("方法:SUP回调,SUP订单号:" + SupOrderID + " 本地系统订单号:" + OrderID +
                           "返回充值状态:" + Status + "-" + StatusNo + " 返回充值详情:" + DetailMsg, LogPathFile.Other.ToString());

            string md5str    = SupOrderID + OrderID + StatusNo + key;
            string checkSign = Md5Helper.GetMD5String_utf8(md5str);

            if (Sign2 == checkSign)
            {
                int    RechargeStatus = (int)OrderRechargeStatus.processing;
                string RechargeMsg    = DetailMsg + SupOrderID;

                switch (StatusNo)
                {
                case "0":
                    RechargeStatus = (int)OrderRechargeStatus.successful;
                    break;

                case "1":
                    RechargeStatus = (int)OrderRechargeStatus.failure;
                    break;

                case "2":
                    RechargeStatus = (int)OrderRechargeStatus.processing;
                    break;

                case "3":
                default:
                    RechargeStatus = (int)OrderRechargeStatus.suspicious;
                    break;
                }


                new SQLOrder().UpdateNotifyOrderBySql(OrderID, RechargeStatus, RechargeMsg);
            }
            else
            {
                WriteLog.Write("方法:SUP回调,SUP订单号:" + SupOrderID + " 本地系统订单号:" + OrderID +
                               "签名验证错误,SUP数字签名" + Sign2 + "本地签名:" + checkSign, LogPathFile.Other.ToString());
            }


            Response.Write("ok");
        }
Exemplo n.º 3
0
        string setPostDate(Order order)
        {
            string catagory  = string.Empty;;
            string productNo = getProductNo(order.ProductID);

            string ChargeAccount = "";
            string RoleName      = "";

            string[] arr = order.TargetAccount.Split(new[] { ';' }, StringSplitOptions.RemoveEmptyEntries);
            if (arr != null)
            {
                ChargeAccount = arr[0];
                if (arr.Length > 1)
                {
                    RoleName = arr[1];
                }
            }

            if (string.IsNullOrEmpty(ChargeAccount))
            {
                ChargeAccount = order.TargetAccount;
            }

            string md5str = merchantID + catagory + order.BuyAmount + ChargeAccount + key;
            string Sign   = Md5Helper.GetMD5String_utf8(md5str);

            StringBuilder str = new StringBuilder();

            str.AppendFormat("MerchantID={0}", merchantID);                                                         //商家编号
            str.AppendFormat("&Catagory={0}", catagory);                                                            //目录(对接的每一套系统此参数都是有差异的,具体数据请通过接口获取)
            str.AppendFormat("&ProductNo={0}", productNo);                                                          //商品编号(关联的商品编号,如果为‘0’系统自动分配)
            str.AppendFormat("&BuyNumber={0}", order.BuyAmount);                                                    //购买数量(每个充值号购买数量)
            str.AppendFormat("&ChargeAccount={0}", System.Web.HttpUtility.UrlEncode(ChargeAccount, Encoding.UTF8)); //充值号(多个用','分隔)
            str.AppendFormat("&Sign={0}", Sign);                                                                    //数字签名,MD5加密(MerchantID+Catagory+BuyNumber+ChargeAccount   +key)
            str.AppendFormat("&OrderID={0}", order.OrderInsideID);                                                  //合作商自定义的下游订单编号
            str.AppendFormat("&FaceValue={0}", Convert.ToInt16(order.ProductParValue));                             //订单面值(默认为0)
            str.AppendFormat("&GameName={0}", System.Web.HttpUtility.UrlEncode(order.GameName, Encoding.UTF8));     //充值名称(如DNF点券)
            str.AppendFormat("&Area={0}", System.Web.HttpUtility.UrlEncode(order.AreaName, Encoding.UTF8));         //充值区域
            str.AppendFormat("&Srv={0}", System.Web.HttpUtility.UrlEncode(order.ServerName, Encoding.UTF8));        //充值服务器
            str.AppendFormat("&Otherinfo={0}", "");                                                                 //其他信息
            str.AppendFormat("&ReturnUrl={0}", "http://116.62.44.48/NotifyFromSUP.aspx");                           //回调地址(详细说明见下方)
            str.AppendFormat("&RechargeType={0}", "");                                                              //充值类型(具体数据参考文档最后)
            str.AppendFormat("&BuyerIp={0}", "");                                                                   //买家IP地址
            str.AppendFormat("&OrderType={0}", "0");                                                                //订单类型(1:官方卡密 0:接口供货),
            str.AppendFormat("&RoleName={0}", RoleName);                                                            //角色名称(部分游戏有)

            return(str.ToString());
        }
Exemplo n.º 4
0
        public string queryOrder(Order order, string merchantOrderID, ref string msg)
        {
            int    num    = 0;
            string status = "未处理";

            while (num < 5)
            {
                coockie = new CookieContainer();
                string        strmd5 = merchantID + merchantOrderID + key;
                string        sign   = Md5Helper.GetMD5String_utf8(strmd5);
                StringBuilder str    = new StringBuilder();
                str.AppendFormat("MerchantID={0}", merchantID);
                str.AppendFormat("&OrderID={0}", merchantOrderID); //订单编号(多个订单以','分隔)
                str.AppendFormat("&Sign={0}", sign);               //数字签名(MerchantID+OrderID+key)
                str.AppendFormat("&MerchantType={0}", "0");        //商家类型(默认为0):0进货商、1供货商
                str.AppendFormat("&OrderIDType={0}", "0");         //状态(默认为0):0易约销售系统生成的订单编号、1合作商自定义的下游订单编号


                WriteLog.Write("方法:Charge,订单号:" + order.OrderInsideID + " sup 订单查询参数:" + str.ToString(), LogPathFile.Recharge.ToString());

                string result = PostAndGet.HttpPostString("http://hphy.eyuesale.com/api/QueryOrder", str.ToString(), ref coockie);

                WriteLog.Write("方法:Charge,订单号:" + order.OrderInsideID + " sup 订单查询:" + result, LogPathFile.Recharge.ToString());

                status = Regex.Match(result, @"<Status>(.*?)</Status>").Groups[1].Value;
                msg    = Regex.Match(result, @"<DetailMsg>(.*?)</DetailMsg>").Groups[1].Value;

                if (status == "未处理")
                {
                    System.Threading.Thread.Sleep(2 * 1000);
                    num++;
                }
                if (status == "充值成功" || status == "充值失败")
                {
                    break;
                }

                if (num > 5)
                {
                    status = "可疑";
                    msg    = "查询订单结果失败";
                }
            }
            return(status);
        }
Exemplo n.º 5
0
        public List <Order> getOrderFromSUP(ref int getOrderTime)
        {
            getOrderTime = time;

            List <Order> orderSet = new List <Order>();

            try
            {
                string sign     = Md5Helper.GetMD5String_utf8(merchantID + key);
                string postData = string.Format("MerchantID={0}&Sign={1}&ProductNo={2}&Count={3}&Status={4}", merchantID, sign, "", count, "0");

                System.Net.CookieContainer cookie = new System.Net.CookieContainer();

                WriteLog.Write("方法:getOrderFromSUP 获取订单参数:" + postData, LogPathFile.Other);

                string result = PostAndGet.HttpGetString(getOrderurl, postData, ref cookie);

                WriteLog.Write("方法:getOrderFromSUP 获取订单信息:" + result, LogPathFile.Other);



                string State = Regex.Match(result, @"<State>(.*?)</State>").Groups[0].Value;

                string State_Info = Regex.Match(result, @"<State_Info>(.*?)</State_Info>").Groups[0].Value;

                if (State.Contains("0") && State_Info.Contains("成功"))
                {
                    assignmentOrder(orderSet, result);
                }
            }
            catch (Exception ex)
            {
                WriteLog.Write("方法:getOrderFromSUP异常,信息:" + ex.Message + ex.StackTrace, LogPathFile.Exception);
            }

            return(orderSet);
        }
Exemplo n.º 6
0
        static void Main(string[] args)
        {
            List <string> ses = new List <string>();

            ses.Add("444");
            ses.Add("4434");
            ses.Add("44e4");
            ses.Add("44e4");

            List <Order> orders  = new List <Order>();
            Order        order12 = new Order()
            {
                OrderID  = 1653631,
                IsNotify = true
            };
            Order order1 = new Order()
            {
                OrderID  = 1653630,
                IsNotify = true
            };

            orders.Add(order12);
            orders.Add(order1);

            new SQLOrder().MultiUpdateData(orders);

            CookieContainer coockie = new CookieContainer();
            string          result  = PostAndGet.HttpPostString("http://121.42.166.214:8099/select.aspx", "username=15071226434&type=qb&sporderid=01201904152304350000011081&buyhaoma=3258222489&sign=0a81867f2a42f8990cd6e47e0cc45a69", ref coockie);



            string AreaName   = "第四十九大区(王者/天使电信)";
            string Servername = "王者一区(电信)";
            string Area       = "";
            string Server     = "";

            new PayAndQuerySW().getmoyuAreaAndServer("魔域", AreaName, Servername, ref Area, ref Server);

            List <Order> dbOrderList = new SQLOrder().GetOrder_top1000();

            Order order123 = new Order()
            {
                OrderExternalID = "2695468386217401"
            };

            GetAndNotifySUPOrders.CheckRepeatOrder(order123, dbOrderList);

            bool bo = new PayAndQuerySW().isChinese("ksdflhg少哦好东西 41561");

            int ssssssss = new QuerySW().getOrderStatus("upay_oidb_0x4fd verify failed for uin[166355766] userip[223.4.205.37] valid[0] reason[4]", "601");

            Order order133 = new Order()
            {
                OrderInsideID = "11",
                BuyAmount     = 1,
                TargetAccount = "鄂尔多斯飞",
                //CustomerIp = "223.104.63.183"
            };

            new PayAndQueryBaiYou().SubmitOrder(order133);

            new ChargeInterface.Charge.PayFulu().Charge(order133);

            new PayAndQueryXunTong().SubmitOrder(order133);

//2018/6/24 21:27:58	方法:Kamen回调,ChargeTime:2018-06-24 21:27:55 CustomerOrderNo:01201806242127490000000008OrderNo:1375870705 ReMark:交易失败 Status:False
//2018/6/24 21:27:58	方法:Kamen回调,Kamen订单号:1375870705 本地系统订单号:01201806242127490000000008签名验证错误,Kamen数字签名69962afcc9ff56fdd4fadfbb04ea5841本地签名:D70A7255A9D91F4E867340B4288C55AF


            string md5str          = "chargetime=2018-06-24 21:27:55&customerorderno=01201806242127490000000008&orderno=1375870705&remark=" + System.Web.HttpUtility.UrlEncode("交易失败", Encoding.UTF8) + "&Status=False918BB8A545017EB8B5E26D9F62AD33E1";
            string ChargeTime      = "2016-02-18 11:44:06";
            string CustomerOrderNo = "t0001";
            string OrderNo         = "653063195";
            string ReMark          = "交易成功";
            string Status          = "True";
            string Secret          = "F636297CB44B2F02BA4651282266EC2F";
            string sData           = "chargetime=" + ChargeTime.Replace("/", "-") + "&customerorderno=" + CustomerOrderNo + "&orderno=" + OrderNo + "&remark="
                                     + ReMark + "&status=" + Status;

            //string sign = EncryptMd5UTF8(sData+Secret);

            md5str = "chargetime=2016-02-18 11:44:06&customerorderno=t0001&orderno=653063195&remark=交易成功&status=TrueF636297CB44B2F02BA4651282266EC2F";
            //md5str = "chargetime=2014-11-12 10:31:03&customerorderno=493171&orderno=338833405&remark=交易成功&status=True+商户密钥";

            string dfdd = System.Web.HttpUtility.UrlEncode(md5str, Encoding.UTF8);
            //ec01cb60874420ab1c11083b07dd98ad

            string checkSign = Md5Helper.EncryptMd5_Kamen1(sData + Secret);


            // 01201903312106160000107708 RuiLian 提交参数:oid=01201903312106160000107708&cid=100183&pid=1078&pn=%e7%b4%ab%e5%85%89%e9%98%81-&nb=1&fm=15.0000&ru=http%3a%2f%2f116.62.44.48%2fNotifyFromRuiLian.aspx&at=&ct=%e6%96%b0%e6%b5%aa%e5%be%ae%e5%8d%9a%e4%bc%9a%e5%91%98&fr=&fs=&rin=&pip=219.140.132.224&info1=&info2=&sign=7839fe0efd29c9775f86d392f1182918

            //Kamen数字签名69962afcc9ff56fdd4fadfbb04ea5841本地签名:D70A7255A9D91F4E867340B4288C55AF



            // "oid=101447975&cid=test&pid=10097&pn=123456&nb=1&fm=1&ru=backcallurl&at=xxx&ct=xxx&fr=xxx&fs=xxx&rin=xxx&pip=118.249.190.100&info1=xxx&info2=xxx
            //&sign=c608f410759bf59d925ceb9d9c02dad0"


            string md5str1 = "101447975-test-10097-123456-1-1-backcallurl-test";
            string sign1   = Md5Helper.GetMD5String_utf8(md5str1);
            string sign2   = Md5Helper.EncryptMd5_Kamen(md5str1);
            string sign3   = Md5Helper.EncryptMd5_Kamen1(md5str1);

            Order order = new Order();

            order.BuyAmount     = 10;
            order.TargetAccount = "15072412234";
            ChargeInterface.Charge.Pay_91_com pt = new ChargeInterface.Charge.Pay_91_com();
            order = pt.Charge(order);

            new QuerySW().Query(order);

            CookieContainer cookie = new CookieContainer();
            Cookie          ck     = new Cookie()
            {
                Name   = "test",
                Value  = "123",
                Domain = "www"
            };

            cookie.Add(ck);

            Common.CookieOperation.CookieHelper.WriteCookiesToDisk("357440019", cookie);

            CookieContainer cc = Common.CookieOperation.CookieHelper.ReadCookiesFromDisk("E:\\testcookie\\357440019");

            string ss = ChargeInterface.ChargeHelper.OrderHelper.OrderStatusForXml.GetOrderStatus("91y", "充值失败");

            Console.WriteLine(ss);
            ss = ChargeInterface.ChargeHelper.OrderHelper.OrderStatusForXml.GetOrderStatus("91y", "充值成功");

            Console.WriteLine(ss);
        }